3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [['a'],['b']]; echo "<!DOCTYPE html> <html> <head> <style> table { width: 100%; max-width: 100%; margin-bottom: 20px; } th, td { white-space: nowrap } thead { text-align: left } </style> </head> <body> <table> <thead> <tr> <?php foreach (array_keys(reset($array)) as $heading): ?> <th><?php echo ucwords(strtr($heading, ['_' => ' '])); ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <?php foreach ($array as $sub_array): ?> <tr> <?php foreach ($sub_array as $value): ?> <td><?php echo $value; ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> </body> </html>";
based on 8QRXm
Output for 7.0.0 - 7.2.0
Notice: Array to string conversion in /in/n8Mhg on line 26 Notice: Undefined variable: heading in /in/n8Mhg on line 26 Notice: Undefined variable: heading in /in/n8Mhg on line 27 Notice: Array to string conversion in /in/n8Mhg on line 33 Notice: Undefined variable: sub_array in /in/n8Mhg on line 33 Notice: Undefined variable: sub_array in /in/n8Mhg on line 35 Notice: Undefined variable: value in /in/n8Mhg on line 35 Notice: Undefined variable: value in /in/n8Mhg on line 36 <!DOCTYPE html> <html> <head> <style> table { width: 100%; max-width: 100%; margin-bottom: 20px; } th, td { white-space: nowrap } thead { text-align: left } </style> </head> <body> <table> <thead> <tr> <?php foreach (array_keys(reset(Array)) as ): ?> <th><?php echo ucwords(strtr(, ['_' => ' '])); ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <?php foreach (Array as ): ?> <tr> <?php foreach ( as ): ?> <td><?php echo ; ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> </body> </html>
Output for 5.4.11 - 5.6.28
Notice: Array to string conversion in /in/n8Mhg on line 26 Notice: Undefined variable: heading in /in/n8Mhg on line 27 Notice: Undefined variable: heading in /in/n8Mhg on line 33 Notice: Array to string conversion in /in/n8Mhg on line 33 Notice: Undefined variable: sub_array in /in/n8Mhg on line 35 Notice: Undefined variable: sub_array in /in/n8Mhg on line 35 Notice: Undefined variable: value in /in/n8Mhg on line 36 Notice: Undefined variable: value in /in/n8Mhg on line 44 <!DOCTYPE html> <html> <head> <style> table { width: 100%; max-width: 100%; margin-bottom: 20px; } th, td { white-space: nowrap } thead { text-align: left } </style> </head> <body> <table> <thead> <tr> <?php foreach (array_keys(reset(Array)) as ): ?> <th><?php echo ucwords(strtr(, ['_' => ' '])); ?></th> <?php endforeach; ?> </tr> </thead> <tbody> <?php foreach (Array as ): ?> <tr> <?php foreach ( as ): ?> <td><?php echo ; ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> </body> </html>
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/n8Mhg on line 3
Process exited with code 255.