3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keys = array(); $header = array(); //get all keyes from first object foreach($q2 as $key){ $header[] = $key->row_name; } $q2a = json_decode(json_encode($q2), true); foreach($q2a as $q){ foreach($q as $k => $v){ $tmp_array[$k][] = $v; } } $output='<table><tr><th></th>'; foreach($header as $key){ $output .= '<th>' . $key . '</th>'; } $output .= '</tr>'; $tmp_array = array_slice($tmp_array, 1, -1); foreach($tmp_array as $key => $val){ $arl = count($val); $output .= '<tr>'; //display keys for($i = 0; $i < $arl ; $i++ ){ $output .= '<td>'. $key[$i] .'</td>'; //display values for($i = 0; $i < $arl; $i++ ){ $output .= '<td>'. $val[$i] .'</td>'; } $output .= '</tr>'; } } $output .= '</table>'; echo $output;
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $q2 in /in/qvuvi on line 7 Warning: foreach() argument must be of type array|object, null given in /in/qvuvi on line 7 Warning: Undefined variable $q2 in /in/qvuvi on line 11 Warning: foreach() argument must be of type array|object, null given in /in/qvuvi on line 12 Warning: Undefined variable $tmp_array in /in/qvuvi on line 26 Fatal error: Uncaught TypeError: array_slice(): Argument #1 ($array) must be of type array, null given in /in/qvuvi:26 Stack trace: #0 /in/qvuvi(26): array_slice(NULL, 1, -1) #1 {main} thrown in /in/qvuvi on line 26
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:
68.88 ms | 402 KiB | 8 Q