Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

range() Lists Everything Between Strings

range() used to cast the arguments to integers. In PHP 8.3, strings are used as is, and range() returns the list of chars between the ASCII codes of those strings.

PHP code

<?php

print_r(range('0', 'A')); 

?>

Before

Array
(
    [0] => 0
)

After

Array
(
    [0] => 0
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 4
    [5] => 5
    [6] => 6
    [7] => 7
    [8] => 8
    [9] => 9
    [10] => :
    [11] => ;
    [12] => <
    [13] => =
    [14] => >
    [15] => ?
    [16] => @
    [17] => A
)

PHP version change

This behavior changed in 8.3.

Extension

© 2023-2026, Damien Seguy - Exakat