note 128321 added to function.array-unique

From: Date: Sat, 18 Mar 2023 12:35:38 +0000
Subject: note 128321 added to function.array-unique
Groups: php.notes 
Request: Send a blank email to php-notes+get-220278@lists.php.net to get a copy of this message
<?php //removes duplicated objetcs from an array according to the property given class ArrayFilter { public static function dedupe_array_of_objets(array $array, string $property) : array { $i = 0; $filteredArray = array(); $keyArray = array(); foreach($array as $item) { if (!in_array($item->$property, $keyArray)) { $keyArray[$i] = $item->$property; $filteredArray[$i] = $item; } $i++; } return $filteredArray; } } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 154.72.163.97) ---- Manual Page -- https://php.net/manual/en/function.array-unique.php Edit -- https://main.php.net/note/edit/128321 Del: integrated -- https://main.php.net/note/delete/128321/integrated Del: useless -- https://main.php.net/note/delete/128321/useless Del: bad code -- https://main.php.net/note/delete/128321/bad+code Del: spam -- https://main.php.net/note/delete/128321/spam Del: non-english -- https://main.php.net/note/delete/128321/non-english Del: in docs -- https://main.php.net/note/delete/128321/in+docs Del: other reasons-- https://main.php.net/note/delete/128321 Reject -- https://main.php.net/note/reject/128321 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220278) next »