3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $p1_name = "Dave"; $p2_name = "Skorton"; $p1_guess = $_POST['player1']; $p2_guess = $_POST['player2']; $target = rand(1, 10); $p1_miss = abs($p1_guess - $target); $p2_miss = abs($p2_guess - $target); $winner_name = if ($p1_miss > $p2_miss) { $p1_name; } elseif ($p1_miss < $p2_miss) { $p2_name; } else { $both_name; } echo "<h2>Result from last round</h2>"; echo "<p>" . $p1_name . "guessed" . $p1_guess . "</p>"; echo "<p>" . $p2_name . "guessed" . $p2_guess . "</p>"; echo "<p>The random number is " . $target; echo $winner_name . "is the winner";
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected 'if' (T_IF) in /in/m587Q on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_IF in /in/m587Q on line 13
Process exited with code 255.