ID: 11524
Updated by: cardinal
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Bogus
Bug Type: Arrays related
Operating system: 
PHP Version: 4.0.5
Assigned To: 
Comments:

Please see the man pages for array_shift and array_pop.

Both functions return the element they removed, not the
modified array.  So, $uri = array_shift($uri); is returning
an empty string, the first element of the array.


Previous Comments:
---------------------------------------------------------------------------

[2001-06-17 18:32:12] [EMAIL PROTECTED]
Let's say I have this string: 
/FAQ/ 
(a URI, actually) 
An explode action (delim is /)with a resulting count of the array reveals 3 elements. 
After an array_shift or array_pop, the count goes to 1. 3-1=1?

$uri = 
strtolower(preg_replace("/[^a-zA-Z0-9/]/","",$HTTP_SERVER_VARS["REQUEST_URI"]));
$uri = explode("/", $uri); // make it an array
echo count($uri);
$uri = array_shift($uri); // delete first value which is always empty
echo count($uri);


---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=11524&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to