RE: [PHP] Object Issues

From: Date: Tue, 08 Apr 2003 17:40:10 +0000
Subject: RE: [PHP] Object Issues
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142928@lists.php.net to get a copy of this message
so if you do $somename = new graphic(); Are you then trying to print $somename->data or $somename->$data ? $somename->$data is incorrect. I wouldn't access member variables directly through my script anyway, I'd use a member method to do it, but that's just my C++ prof drilling encapsulation rules into my head years ago. Also, I'm not so sure != NULL is correct since logically (NULL != NULL) is true. Maybe PHP doesn't play by those rules though, I've never tried using that expression, so I don't know how PHP treats it. > -----Original Message----- > From: Piero B. Contezini [mailto:piero.contezini@dauphin.com.br] > Sent: Tuesday, April 08, 2003 7:11 AM > To: php-general@lists.php.net > Subject: [PHP] Object Issues > > > Hello, i'm currently having problems with assigning object variables, > let me show what's happening: > > class graphic { > var $data; > > function assign($dbhandler) { > while($dbhandler->fetch() !=NULL) { > $var[] = $dbhandler->data; > } > $this->data = $var; > } > } > > When I call assign() , inside the function, $data variable is full with > my stuff, but when I print the object outside the function the variable > $data is always empty, doesn't matter what I do, copying variables, try > to alocate with array(), anything. > > Someone have been on this issue before? > > Piero > > "It occurred to me by intuition, and music was the driving force behind > that intuition. My discovery was the result of musical perception". > Albert Einstein > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#142928) next »