3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $var11 = '12345'; $var12 = '22b'; $var13 = '12345x'; $var14 = '22'; $var15 = 12345; $var16 = 22; say("string comparisons:"); comparevar('var11 and var12', $var11, $var12); comparevar('var12 and var11', $var12, $var11); say("one numeric string, one string, make string comparisons:"); comparevar('var13 and var14', $var13, $var14); comparevar('var14 and var13', $var14, $var13); say("two numeric strings make numeric comparisons:"); comparevar('var11 and var14', $var11, $var14); comparevar('var14 and var11', $var14, $var11); say("two strings make string comparisons:"); comparevar('var12 and var13', $var12, $var13); comparevar('var13 and var12', $var13, $var12); say("two numbers make numeric comparisons:"); comparevar('var15 and var16', $var15, $var16); comparevar('var16 and var15', $var16, $var15); say("one numeric string, one number, make numeric comparisons:"); comparevar('var11 and var14', $var11, $var14); comparevar('var14 and var11', $var14, $var11); comparevar('var15 and var16', $var15, $var16); comparevar('var16 and var15', $var16, $var15); comparevar('var11 and var15', $var11, $var15); comparevar('var16 and var14', $var16, $var14); say("one string, one number, make numeric comparisons:"); comparevar('var13 and var15', $var13, $var15); comparevar('var12 and var16', $var12, $var16); comparevar('var13 and var16', $var13, $var16); comparevar('var15 and var12', $var15, $var12); say("and then some weirdness"); comparevar('var13 and var14', $var13, $var14); comparevar('var13 and var16', $var13, $var16); comparevar('var14 and var13', $var14, $var13); comparevar('var16 and var13', $var16, $var13); comparevar('var14 and var16', $var14, $var16); function comparevar($tag, $arg1, $arg2) { echo("$tag: "); if ($arg1 === $arg2) { say("$arg1 === $arg2"); } if ($arg1 == $arg2) { say("$arg1 == $arg2"); } if ($arg1 < $arg2) { say("$arg1 < $arg2"); } if ($arg1 > $arg2) { say("$arg1 > $arg2"); } if ((not ($arg1 < $arg2)) != ($arg1 > $arg2)) {say("screwy 1");} } function say($str) { echo $str, "\n"; }
based on 68kjv
Output for 7.0.0 - 7.1.0
string comparisons: var11 and var12: 12345 < 22b Fatal error: Uncaught Error: Call to undefined function not() in /in/JZTIu:62 Stack trace: #0 /in/JZTIu(12): comparevar('var11 and var12', '12345', '22b') #1 {main} thrown in /in/JZTIu on line 62
Process exited with code 255.
Output for 5.0.0 - 5.6.28, hhvm-3.12.0
string comparisons: var11 and var12: 12345 < 22b Fatal error: Call to undefined function not() in /in/JZTIu on line 62
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.5 - 4.4.9
string comparisons: var11 and var12: 12345 < 22b Fatal error: Call to undefined function: not() in /in/JZTIu on line 62
Process exited with code 255.
Output for 4.3.2 - 4.4.4
string comparisons: var11 and var12: 12345 < 22b Fatal error: Call to undefined function: not() in /in/JZTIu on line 62
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string comparisons: var11 and var12: 12345 < 22b Fatal error: Call to undefined function: not() in /in/JZTIu on line 62