3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = [ (object)['menu_id' => 1, 'menu_name' => 'one'], (object)['menu_id' => 2, 'menu_name' => 'two'], (object)['menu_id' => 3, 'menu_name' => 'three'], ]; ?> <form action=""> <table> <thead> <tr> <th>Menu Id</th> <th>Menu Name</th> <th>Yes/No</th> </tr> </thead> <tbody> <?php foreach($result as $res) { ?> <tr> <td><?= $res->menu_id ?></td> <td><?= $res->menu_name ?></td> <td><input type="checkbox" name="yes[]" value="<?= $res->menu_id ?>"></td> </tr> <?php } ?> </tbody> </table>
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<form action=""> <table> <thead> <tr> <th>Menu Id</th> <th>Menu Name</th> <th>Yes/No</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>one</td> <td><input type="checkbox" name="yes[]" value="1"></td> </tr> <tr> <td>2</td> <td>two</td> <td><input type="checkbox" name="yes[]" value="2"></td> </tr> <tr> <td>3</td> <td>three</td> <td><input type="checkbox" name="yes[]" value="3"></td> </tr> </tbody> </table>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <form action=""> <table> <thead> <tr> <th>Menu Id</th> <th>Menu Name</th> <th>Yes/No</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>one</td> <td><input type="checkbox" name="yes[]" value="1"></td> </tr> <tr> <td>2</td> <td>two</td> <td><input type="checkbox" name="yes[]" value="2"></td> </tr> <tr> <td>3</td> <td>three</td> <td><input type="checkbox" name="yes[]" value="3"></td> </tr> </tbody> </table>

preferences:
182.19 ms | 403 KiB | 166 Q