3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = array( array( "id", "int(10) unsigned", "NO", "PRI", "auto_increment" ), array( "title", "varchar(32)", "NO" ), array( "author", "varchar(32)", "NO" ), array( "category", "tinyint(3) unsigned", "NO" ), array( "date", "datetime", "NO" ), array( "post_ip", "int(10) unsigned", "NO" ), array( "approved_by", "varchar(32)", "NO" ), array( "text", "text", "NO" ) ); $cols = array(); $rows = 0; foreach ($d as $row) { ($rows < count($row) && $rows = count($row)); foreach($row as $id => $col) { (!isset($cols[$id]) && $cols[$id] = 0); ($cols[$id] < strlen($col) && $cols[$id] = strlen($col)); } } print_R($cols); foreach ($d as $row) { $row = array_pad($row,$rows,''); foreach ($row as $colid => &$col) $col = str_pad($col, $cols[$colid]); echo implode($row," # ") . "\n"; } /* id # int(10) unsigned # NO # PRI # auto_increment # [19:44] <teehee> title # varchar(32) # NO # [19:44] <teehee> author # varchar(32) # NO # [19:44] <teehee> category # tinyint(3) unsigned # NO # [19:44] <teehee> date # datetime # NO # [19:44] <teehee> post_ip # int(10) unsigned # NO # [19:44] <teehee> approved_by # varchar(32) # YES # [19:44] <teehee> text # text # NO # */
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 11 [1] => 19 [2] => 2 [3] => 3 [4] => 14 ) Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/U8aO3:36 Stack trace: #0 /in/U8aO3(36): implode(Array, ' # ') #1 {main} thrown in /in/U8aO3 on line 36
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.12 ms | 401 KiB | 8 Q