3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array ( 0 => array ( 'admin_id' => '4', 'full_name' => 'Jesse Donat', 'timestamp' => 'Thu, 23 Oct 2014 03:34:40 +0000', ), 1 => array ( 'admin_id' => '4', 'full_name' => 'Jesse Donat', 'timestamp' => 'Thu, 23 Oct 2014 03:34:40 +0000', ), 2 => array ( 'bbq' => 'soda', ), ); print_r($data); $data = array_reduce($data, function ($c, $i) { if (count($c) == 0 && !in_array($i, $c)) { $c[] = $i; }}, []); print_r($data);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [admin_id] => 4 [full_name] => Jesse Donat [timestamp] => Thu, 23 Oct 2014 03:34:40 +0000 ) [1] => Array ( [admin_id] => 4 [full_name] => Jesse Donat [timestamp] => Thu, 23 Oct 2014 03:34:40 +0000 ) [2] => Array ( [bbq] => soda ) ) Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/T1Xvi:23 Stack trace: #0 [internal function]: {closure}(NULL, Array) #1 /in/T1Xvi(23): array_reduce(Array, Object(Closure), Array) #2 {main} thrown in /in/T1Xvi on line 23
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:
44.78 ms | 402 KiB | 8 Q