3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump( strcmp("5", 5), // => 0 strcmp("15", 0xf), // => 0 strcmp(61529519452809720693702583126814, 61529519452809720000000000000000), // => 0 strcmp(NULL, false), // => 0 strcmp(NULL, ""), // => 0 strcmp(NULL, 0), // => -1 strcmp(false, -1), // => -2 strcmp("15", NULL), // => 2 strcmp(NULL, "foo"), // => -3 strcmp("foo", NULL), // => 3 strcmp("foo", false), // => 3 strcmp("foo", 0), // => 1 strcmp("foo", 5), // => 1 strcmp("foo", array()), // => NULL + PHP Warning strcmp("foo", new stdClass), // => NULL + PHP Warning strcmp(function(){}, "") // => NULL + PHP Warning );
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /in/X3SnD on line 6 Deprecated: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /in/X3SnD on line 7 Deprecated: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /in/X3SnD on line 8 Deprecated: strcmp(): Passing null to parameter #2 ($string2) of type string is deprecated in /in/X3SnD on line 10 Deprecated: strcmp(): Passing null to parameter #1 ($string1) of type string is deprecated in /in/X3SnD on line 11 Deprecated: strcmp(): Passing null to parameter #2 ($string2) of type string is deprecated in /in/X3SnD on line 12 Fatal error: Uncaught TypeError: strcmp(): Argument #2 ($string2) must be of type string, array given in /in/X3SnD:16 Stack trace: #0 /in/X3SnD(16): strcmp('foo', Array) #1 {main} thrown in /in/X3SnD on line 16
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught TypeError: strcmp(): Argument #2 ($string2) must be of type string, array given in /in/X3SnD:16 Stack trace: #0 /in/X3SnD(16): strcmp('foo', Array) #1 {main} thrown in /in/X3SnD on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: strcmp() expects parameter 2 to be string, array given in /in/X3SnD on line 16 Warning: strcmp() expects parameter 2 to be string, object given in /in/X3SnD on line 17 Warning: strcmp() expects parameter 1 to be string, object given in /in/X3SnD on line 18 int(0) int(0) int(0) int(0) int(0) int(-1) int(-2) int(2) int(-3) int(3) int(3) int(54) int(49) NULL NULL NULL
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/X3SnD on line 18
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 T_FUNCTION, expecting ')' in /in/X3SnD on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/X3SnD on line 18
Process exited with code 255.

preferences:
292.7 ms | 401 KiB | 464 Q