3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["red", "color" => "red", 78, 78, 12, "12", false, null, false, 0, true, 1, 0, null, 2.12, "2.12", 8, "-s"]; sort($array); var_dump($array); // var_dump(array_unique($array, SORT_REGULAR));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
array(18) { [0]=> bool(false) [1]=> NULL [2]=> bool(false) [3]=> string(2) "-s" [4]=> int(0) [5]=> int(0) [6]=> NULL [7]=> int(12) [8]=> string(2) "12" [9]=> int(78) [10]=> int(78) [11]=> string(3) "red" [12]=> bool(true) [13]=> int(1) [14]=> float(2.12) [15]=> string(4) "2.12" [16]=> int(8) [17]=> string(3) "red" }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array(18) { [0]=> bool(false) [1]=> NULL [2]=> bool(false) [3]=> string(2) "-s" [4]=> int(0) [5]=> int(0) [6]=> NULL [7]=> int(12) [8]=> string(2) "12" [9]=> int(78) [10]=> int(78) [11]=> string(3) "red" [12]=> bool(true) [13]=> int(1) [14]=> float(2.12) [15]=> string(4) "2.12" [16]=> int(8) [17]=> string(3) "red" }
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array(18) { [0]=> NULL [1]=> NULL [2]=> string(3) "red" [3]=> int(0) [4]=> bool(false) [5]=> string(3) "red" [6]=> int(0) [7]=> bool(false) [8]=> string(2) "12" [9]=> int(12) [10]=> bool(true) [11]=> string(2) "-s" [12]=> int(1) [13]=> float(2.12) [14]=> string(4) "2.12" [15]=> int(8) [16]=> int(78) [17]=> int(78) }
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
array(18) { [0]=> NULL [1]=> int(0) [2]=> int(0) [3]=> NULL [4]=> bool(false) [5]=> bool(false) [6]=> bool(true) [7]=> string(2) "-s" [8]=> string(3) "red" [9]=> string(3) "red" [10]=> int(1) [11]=> string(4) "2.12" [12]=> float(2.12) [13]=> int(8) [14]=> int(12) [15]=> string(2) "12" [16]=> int(78) [17]=> int(78) }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/RfFJr on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/RfFJr on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/RfFJr on line 3
Process exited with code 255.

preferences:
340.38 ms | 401 KiB | 468 Q