3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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(); foreach ($d as $row) { foreach($row as $id => $col) { (!isset($cols[$id]) && $cols[$id] = 0); ($cols[$id] < strlen($col) && $cols[$id] = strlen($col)); } } foreach ($d as $row) foreach ($row as $colid => &$col) $col = str_pad($col, $cols[$colid],"k"); print_r($d); /* 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 5.0.0 - 7.1.0
Array ( [0] => Array ( [0] => id [1] => int(10) unsigned [2] => NO [3] => PRI [4] => auto_increment ) [1] => Array ( [0] => title [1] => varchar(32) [2] => NO ) [2] => Array ( [0] => author [1] => varchar(32) [2] => NO ) [3] => Array ( [0] => category [1] => tinyint(3) unsigned [2] => NO ) [4] => Array ( [0] => date [1] => datetime [2] => NO ) [5] => Array ( [0] => post_ip [1] => int(10) unsigned [2] => NO ) [6] => Array ( [0] => approved_by [1] => varchar(32) [2] => NO ) [7] => Array ( [0] => text [1] => text [2] => NO ) )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/UiZVs on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/UiZVs on line 30
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/UiZVs on line 30
Process exited with code 255.