arrays and references

From: Date: Thu, 12 Oct 2000 15:10:28 +0000
Subject: arrays and references
Groups: php.general 
Request: Send a blank email to php-general+get-19818@lists.php.net to get a copy of this message
Hello, I'm new to PHP and new the list. My question is about arrays and references - I'm experienced in Perl and comfortable working with references to scalars/arrays/hashes, but I'm not having any luck getting references to work. I'm probably just not familiar enough yet with PHP. I have a function that query's a MySQL table and finds all the rows in the table(there's less than 10 rows). I'd like to push each row(or reference to each row) onto an array, and return a reference to that "rows" array. But I can't figure out how to do that with references. I *CAN* do that with whole arrays - in other words I can fetch an entire row into array $row, and then I can put that whole $row array onto a $rows array, and then I can return that whole $rows array, and then work with that $rows array in the calling script. Is this the way it should be done - passing whole arrays around? There has to be a way to create an array, and then create a reference to that array, and pass the reference around and work with the reference to refer to elements inside the array. Please help me understand the right way to pass arrays around in PHP as arguments to/from functions. TIA. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com

« previous php.general (#19818) next »