3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ('1' => (object)array( 'id' => 225, 'user_id' => 1, 'name' => 'Blue Quilted Leather Jacket by Minusey - $499' ), '2' => (object)array( 'id' => 222, 'user_id' => 1, 'name' => 'Darling New Bathtub by Duravit - $6300' ), '3' => (object)array( 'id' => 222, 'user_id' => 1, 'name' => 'Darling New Bathtub by Duravit - $6300' ) ); //print_r(array_column((array)$array, 'id')); $array = array_map(function($x){return (array)$x;}, $array); $ids = array_unique(array_column($array, 'id')); $array = array_filter($array, function($x){return in_array($x['id'], $ids);}); print_r($array);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $ids in /in/t4FLb on line 25 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/t4FLb:25 Stack trace: #0 /in/t4FLb(25): in_array(225, NULL) #1 [internal function]: {closure}(Array) #2 /in/t4FLb(25): array_filter(Array, Object(Closure)) #3 {main} thrown in /in/t4FLb on line 25
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:
42.69 ms | 401 KiB | 8 Q