3v4l.org

run code in 300+ PHP versions simultaneously
<form action="check.php" method="post"> <!-- <input type="color" name="dawaj"> --> <input type="number" min="0" max="255" step="1" value="1" name="rR"> <input type="number" min="0" max="255" step="1" value="1" name="gG"> <input type="number" min="0" max="255" step="1" value="1" name="bB"> <input type="submit" name="checkit" value="Check it!"> </form> <?php if(isset($_POST['checkit'])) { $r = $_POST['rR']; $g = $_POST['gG']; $b = $_POST['bB']; $yiq = (($r*299)+($g*587)+($b*114))/1000; if ( $yiq >= 128 ) { echo'<font style="color:black;">Black</font>'; } else { echo'<font style="color:white;">White</font>'; } /*$color = $_POST['dawaj']; $colorcheck=strtolower($color[3]); if($colorcheck>6||is_numeric($colorcheck)===false) echo'<font style="color:black;">Black</font>'; else echo'<font style="color:white;">White</font>';*/ } ?> <style> body { // background-color:rgb(255,0,255); background-color: rgb(<?php echo $r ?>,<?php echo $g ?>,<?php echo $b ?>); color: <?php echo $color; ?>; } </style>
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
<form action="check.php" method="post"> <!-- <input type="color" name="dawaj"> --> <input type="number" min="0" max="255" step="1" value="1" name="rR"> <input type="number" min="0" max="255" step="1" value="1" name="gG"> <input type="number" min="0" max="255" step="1" value="1" name="bB"> <input type="submit" name="checkit" value="Check it!"> </form> <style> body { // background-color:rgb(255,0,255); background-color: rgb( Warning: Undefined variable $r in /in/4gTNO on line 38 , Warning: Undefined variable $g in /in/4gTNO on line 38 , Warning: Undefined variable $b in /in/4gTNO on line 38 ); color: Warning: Undefined variable $color in /in/4gTNO on line 39 ; } </style>
Output for 5.0.4 - 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.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
<form action="check.php" method="post"> <!-- <input type="color" name="dawaj"> --> <input type="number" min="0" max="255" step="1" value="1" name="rR"> <input type="number" min="0" max="255" step="1" value="1" name="gG"> <input type="number" min="0" max="255" step="1" value="1" name="bB"> <input type="submit" name="checkit" value="Check it!"> </form> <style> body { // background-color:rgb(255,0,255); background-color: rgb( Notice: Undefined variable: r in /in/4gTNO on line 38 , Notice: Undefined variable: g in /in/4gTNO on line 38 , Notice: Undefined variable: b in /in/4gTNO on line 38 ); color: Notice: Undefined variable: color in /in/4gTNO on line 39 ; } </style>
Output for 7.3.32 - 7.3.33
<form action="check.php" method="post"> <!-- <input type="color" name="dawaj"> --> <input type="number" min="0" max="255" step="1" value="1" name="rR"> <input type="number" min="0" max="255" step="1" value="1" name="gG"> <input type="number" min="0" max="255" step="1" value="1" name="bB"> <input type="submit" name="checkit" value="Check it!"> </form> <style> body { // background-color:rgb(255,0,255); background-color: rgb(,,); color: ; } </style>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
<form action="check.php" method="post"> <!-- <input type="color" name="dawaj"> --> <input type="number" min="0" max="255" step="1" value="1" name="rR"> <input type="number" min="0" max="255" step="1" value="1" name="gG"> <input type="number" min="0" max="255" step="1" value="1" name="bB"> <input type="submit" name="checkit" value="Check it!"> </form> <style> body { // background-color:rgb(255,0,255); background-color: rgb( Notice: Undefined variable: r in /in/4gTNO on line 38 , Notice: Undefined variable: g in /in/4gTNO on line 38 , Notice: Undefined variable: b in /in/4gTNO on line 38 ); color: Notice: Undefined variable: color in /in/4gTNO on line 39 ; } </style>

preferences:
291.85 ms | 403 KiB | 460 Q