RE: PHP 4.0 Bug #8106 Updated: array_pop problem when using against an array returned from a class

From: Date: Tue, 05 Dec 2000 20:23:59 +0000
Subject: RE: PHP 4.0 Bug #8106 Updated: array_pop problem when using against an array returned from a class
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-40165@lists.php.net to get a copy of this message
Hi, I found out the problem, since im just getting used to PHP coming from Perl, I didn't know that you can have indexed strings, which coming from Perl, look like arrays at first glace, all I had to do was define $query as an array (). Problem solved :o) Cheers > -----Original Message----- > From: Bug Database [mailto:php-dev@lists.php.net] > Sent: Wednesday, 6 December 2000 00:15 > To: drew@cwa.co.nz > Subject: PHP 4.0 Bug #8106 Updated: array_pop problem when using against > an array returned from a class > > > ID: 8106 > Updated by: sniper > Reported By: drew@cwa.co.nz > Status: Feedback > Bug Type: Arrays related > Assigned To: > Comments: > > If you pass a non-array to array_pop() it just displays an > error message. > > After checking the sources for this function, it looks > like it doesn't return anything in case of this error. > > Do you mean it should return FALSE in case of this error? > (I think it should) > > But if you pass an empty array for array_pop() it > won't return anything but will not display any error > messages either which I think is the right behaviour. > > --Jani > > > > Previous Comments: > ------------------------------------------------------------------ > --------- > > [2000-12-04 21:10:00] drew@cwa.co.nz > Seems to return no TRUE value when using array_pop () on an array > returned by a class. > > Code Example: > > <? > class Form { > > function parse ($arg) { > > ereg("(.*)&[(.?)]", $arg, $query); > > return $query; > > } > > } > > $form = new Form; > > $output = $form->parse($QUERY_STRING); > > $number = array_pop($output); > > if ($number) { echo "$number exists"; } > > foreach ($output as $tmp) { > if (($tmp)&&($tmp != $QUERY_STRING)) { > echo "$tmp<Br>"; > } > } > > ?> > > ------------------------------------------------------------------ > --------- > > > Full Bug description available at: http://bugs.php.net/?id=8106 >

« previous php.dev (#40165) next »