3v4l.org

run code in 300+ PHP versions simultaneously
<?php $actualArray = array( user1 => array( 'name' => 'User1', 'age' => '25', 'lastLogin' => '2013-08-16' ), user1 => array( 'name' => 'User1', 'age' => '25', 'lastLogin' => '2013-08-10' ), user2 => array( 'name' => 'User2', 'age' => '35', 'lastLogin' => '2013-08-08' ), user1 => array( 'name' => 'User1', 'age' => '25', 'lastLogin' => '2013-07-10' ) ); function uniqueAssocArray($array, $uniqueKey) { if (!is_array($array)) { return array(); } $uniqueKeys = array(); foreach ($array as $key => $item) { if (!in_array($item[$uniqueKey], $uniqueKeys)) { $uniqueKeys[$item[$uniqueKey]] = $item; } } return $uniqueKeys; } var_dump(uniqueAssocArray($actualArray, 'name'));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "user1" in /in/o63Ys:3 Stack trace: #0 {main} thrown in /in/o63Ys on line 3
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:
51.03 ms | 401 KiB | 8 Q