3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(range([], [])); echo "Range will ignore any byte after the first one\n"; var_dump( range("AA", "BB") ); echo "Range cannot operate on an empty string\n"; var_dump( range("Z", "") ); // Both strings are cast to int, i.e. 0 var_dump( range("", "Z") ); // Both strings are cast to int, i.e. 0 echo "Mixing numeric string and character\n"; var_dump( range("1", "A") ); // The char is cast to an int, i.e. 0 var_dump( range("?", "1") ); // The char is cast to an int, i.e. 0 var_dump( range("3.5", "A") ); // The char is cast to a float, i.e. 0 var_dump( range("?", "3.5") ); // The char is cast to a float, i.e. 0 echo "Fractional step cannot be used on character ranges\n"; var_dump( range("A", "H", 2.6) ); // Because step is fractional it tries to interpret inputs as floats

preferences:
37.27 ms | 402 KiB | 5 Q