RE: [PHP] Array help

From: Date: Thu, 15 Mar 2001 01:40:58 +0000
Subject: RE: [PHP] Array help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43944@lists.php.net to get a copy of this message
> > > Hi, > > Is there a way to do an array_pop with php3? Here's some PHP 3 compatable code that works the same as array_pop: function _array_pop(&$stack) { $arrSize = count($stack); $x = 1; while(list($key, $val) = each($stack)) { if($x < count($stack)) { $tmpArr[] = $val; } else { $return_val = $val; } $x++; } $stack = $tmpArr; return($return_val); } Enjoy :) - James

« previous php.general (#43944) next »