3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach($conn->query($sql) as $row){ if(isset($_SESSION['user_id'])){ echo "<tr><td>".$row['Product_ID']."</td><td>".$row['Naam']."</td><td>".$row['Prijs']."</td><td>".$row['Beschrijving']."</td><td><a class='but_add' href='addItem.php?add=$row[Product_ID]'><i class='far fa-plus-square fa-s'></i> Add</a></td></tr>"; }else{ echo "<tr><td>".$row['Product_ID']."</td><td>".$row['Naam']."</td><td>".$row['Prijs']."</td><td>".$row['Beschrijving']."</td><td><a class='but_add' href='login.php'><i class='far fa-plus-square fa-s'></i> Add</a></td></tr>"; } } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Warning: Undefined variable $conn in /in/1Eb2Y on line 2 Fatal error: Uncaught Error: Call to a member function query() on null in /in/1Eb2Y:2 Stack trace: #0 {main} thrown in /in/1Eb2Y on line 2
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: conn in /in/1Eb2Y on line 2 Fatal error: Uncaught Error: Call to a member function query() on null in /in/1Eb2Y:2 Stack trace: #0 {main} thrown in /in/1Eb2Y on line 2
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to a member function query() on null in /in/1Eb2Y:2 Stack trace: #0 {main} thrown in /in/1Eb2Y on line 2
Process exited with code 255.

preferences:
102.61 ms | 1614 KiB | 4 Q