Answers for "find object in array based on criteria php"

PHP
1

search string inside array of objects php

$item = null;
foreach($array as $struct) {
    if ($v == $struct->ID) {
        $item = $struct;
        break;
    }
}
Posted by: Guest on November-24-2021
-1

php search in object. array

$neededObject = array_filter(
    $arrayOfObjects,
    function ($e) use (&$searchedValue) {
        return $e->id == $searchedValue;
    }
);
Posted by: Guest on September-09-2020

Code answers related to "find object in array based on criteria php"

Browse Popular Code Answers by Language