Arrays : returning a reference to an array item ??

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hello folks,

I am currently storing a set of objects inside an array,

$itemlist = array();
$itemlist[] = new item("myitem");

and I am looking to develop a search function, which returns a
reference to the found item.

function &search_item($itemlist,"myitem") {

I am trying to figure out how to obtain a reference to a given item in
an array.
Indeed, foreach() and each() seem to work on copies of the data in the
For example:

$array = array("a","b","c","d");
foreach($array as $v) $v="xxx";
print_r($array); // $array is unchanged

reset($array) ; while(list(,$v)=each($array)) $v="xxx";
print_r($array); // $array is unchanged, again

Would you have any idea how to achieve what I am looking for ?
Thanks in advance,

Site Timeline