Let's say I have an array of objects.
<?php
$people = array();
$people[] = new person('Walter Cook');
$people[] = new person('Amy Green');
$people[] = new person('Irene Smith');
How can I search an object in this array for a certain instance variable? For example, let's say I wanted to search for a person object with the name of "Walter Cook".
Thanks in advance!
in_array()looks for exact matches, it can't search for objects that have certain properties.foreachloop that compares the person's name, and breaks when it finds it.in_arrayfunction is not what I am looking for. This will only return a boolean, but the object itself.