Home  >  Article  >  Backend Development  >  What does range mean in php

What does range mean in php

WBOY
WBOYOriginal
2022-02-14 10:16:033563browse

In PHP, the range() function means to create an array containing elements in a specified range. This function can return an array of elements between the two specified parameters. The syntax is "range(low,high,step) ".

What does range mean in php

The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer

What does range mean in php

# The ##range() function creates an array containing elements in a specified range.

This function returns an array containing elements from low to high.

Note: If the low parameter is greater than the high parameter, the array created will be from high to low.

Syntax

range(low,high,step)

Parameter Description

low Required. Specifies the minimum value of an array element.

high Required. Specifies the maximum value of an array element.

step Optional. Specifies the stepping between elements. The default is 1.

The example is as follows:

<?php
$number = range(0,5);
print_r ($number);
?>

Output result:

What does range mean in php

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of What does range mean in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn