Re: How to cast objects in arrays.

From: Date: Sat, 06 Jul 2002 20:50:35 +0000
Subject: Re: How to cast objects in arrays.
Groups: php.general 
Request: Send a blank email to php-general+get-105877@lists.php.net to get a copy of this message
Thanks to everyone!!! I have figured it out... Anas Mughal <anasmughal@yahoo.com> wrote: I have a function getRow() that returns a new instance of an object called IvActivity. I insert this new instance into $list. I need to call getTitle method on each of the inserted objects. However, I keep on getting parse error on the line that does the casting. Please help. $i = 0; while ($row = mysql_fetch_array($mysql_result)) { $instance = $this->getRow($row); $list[$i] = $intance; $i++; } // ... foreach ($list as $item) { $act = (IvActivity) $item; echo "item: " . $act->getTitle(); } (I also tried simple for loop with $list[$i] logic. Unf, I am not able to cast those objects either.) __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com --------------------------------- Do You Yahoo!? New! SBC Yahoo! Dial - 1st Month Free & unlimited access

« previous php.general (#105877) next »