3v4l.org

run code in 300+ PHP versions simultaneously
<?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 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"); } } function say($str) { echo $str, "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
string comparisons: var11 and var12: 12345 < 22b var12 and var11: 22b > 12345 one numeric string, one string, make string comparisons: var13 and var14: 12345x < 22 var14 and var13: 22 > 12345x two numeric strings make numeric comparisons: var11 and var14: 12345 > 22 var14 and var11: 22 < 12345 two strings make string comparisons: var12 and var13: 22b > 12345x var13 and var12: 12345x < 22b two numbers make numeric comparisons: var15 and var16: 12345 > 22 var16 and var15: 22 < 12345 one numeric string, one number, make numeric comparisons: var11 and var14: 12345 > 22 var14 and var11: 22 < 12345 var15 and var16: 12345 > 22 var16 and var15: 22 < 12345 var11 and var15: 12345 == 12345 var16 and var14: 22 == 22 one string, one number, make numeric comparisons: var13 and var15: 12345x > 12345 var12 and var16: 22b > 22 var13 and var16: 12345x < 22 var15 and var12: 12345 < 22b and then some weirdness var13 and var14: 12345x < 22 var13 and var16: 12345x < 22 var14 and var16: 22 == 22

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
54 ms | 403 KiB | 8 Q