PHP 8.5.0 Alpha 1 available for testing

Voting

: min(nine, three)?
(Example: nine)

The Note You're Voting On

Alien426
9 years ago
The function will generate an array of integers even if your numerical parameters are enclosed in quotes.
<?php
var_dump
( range('1', '2') ); // outputs array(2) { [0]=> int(1) [1]=> int(2) }
?>

An easy way to get an array of strings is to map strval() to the range:
<?php
var_dump
( array_map('strval', range('1', '2')) ); // outputs array(2) { [0]=> string(1) "1" [1]=> string(1) "2" }
?>

<< Back to user notes page

To Top