3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(!function_exists('is_assoc')){ function is_assoc($array) { return (bool)count(array_filter(array_keys($array), 'is_string')); } } /** * getCols * * Takes an array of associative arrays and combines them to get * the columns * * @author Joe Richardson * @access public * @return object Instance of DB or Null */ function getCols(array $data) { if(is_assoc($data)){ return $data; }else{ return (array)call_user_func_array('array_merge_recursive',$data); } } $a = array( array( 'id' => 1 , 'name' => 'foo' , 'date' => date() ) , array( 'id' => 2 , 'name' => 'bar' , 'date' => date() ) , array( 'id' => 3 , 'name' => 'george' , 'date' => date() ) , array( 'id' => 4 , 'name' => 'burdell' , 'date' => date() ) ); $b = getCols($a); var_dump($b);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: date() expects at least 1 argument, 0 given in /in/a9RUH:37 Stack trace: #0 /in/a9RUH(37): date() #1 {main} thrown in /in/a9RUH on line 37
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:
37.03 ms | 401 KiB | 8 Q