3v4l.org

run code in 300+ PHP versions simultaneously
<?php function say($str) { echo $str, "\n"; } $var1 = 123; $var2 = '456A'; $var3 = 78; $var4 = (float) $var2; $var5 = (int) $var2; say("$var2 converted to float is: $var4"); say("$var2 converted to int is: $var5"); if ($var4 < $var3) { say("$var4 < $var3"); } if ($var5 < $var3) { say("$var5 < $var3"); } say("therefore, as documented,"); if ($var2 < $var3) { say("$var2 < $var3"); }
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.6
456A converted to float is: 456 456A converted to int is: 456 therefore, as documented, 456A < 78
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.32, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
456A converted to float is: 456 456A converted to int is: 456 therefore, as documented,

preferences:
305.59 ms | 404 KiB | 452 Q