What does range mean in php

WBOY
Release: 2023-03-15 10:16:01
Original
3466 people have browsed it

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)
Copy after login

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);
?>
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!