xxxxxxxxxx
<?php
function findObjectById($id){
$array = array( /* your array of objects */ );
foreach ( $array as $element ) {
if ( $id == $element->id ) {
return $element;
}
}
return false;
}
xxxxxxxxxx
/*
To get the properties of an object, you can use the inbuilt function
"get_object_vars(object)", this wille return an array containing all the
properties of the object specified.
*/
$object = new myClass();
$objectproperties = get_object_vars($object)