3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 );
based on 9cdKc
Output for 5.3.0 - 7.2.0
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.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.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.