php range() function
Translation results:
英[reɪndʒ] 美[rendʒ]
n.Range; range; category; (mountains, houses, etc.) arrangement
vi.Search; change; extension; roaming
vt. Arrange; sort (in a certain position or order); classify...; wander
adj. Pasture, grazing area
Third person singular: ranges Plural: ranges Present participle: ranging Past tense: ranged Past participle: ranged
php range() functionsyntax
Function:Create an array containing elements in the specified range
Syntax: range(low,high,step)
Parameters:
Parameters | Description |
low | Required. Specifies the minimum value of the array. |
high | Required. Specifies the maximum value of the array. |
step | Optional. Specifies the stepping between elements. The default is 1. |
Description: This function creates an array containing integers or characters from low to high (including low and high). If high is smaller than low, return the array in reverse order.
php range() functionexample
<?php $number = range(1,6); print_r ($number); ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )
<?php $str = range('b','e'); print_r ($str); ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
Array ( [0] => b [1] => c [2] => d [3] => e )
Popular Recommendations
- MKR Price Prediction: Is a Range Breakout Emerging?
- Decathlon launches two new mid-range BTWIN e-scooters
- Garmin releases new update for mid-range smartwatch with important bug fixes
- Bitcoin BTCUSD Plunged Below the $55,724 to $73,777 Range on Sept. 6
- HMD Vibe Pro: Specs and pricing leak for unreleased mid-range smartphone
- Biden, Starmer to discuss letting Kyiv use long-range missiles against Russia