[PHP] explode and PATH_SEPARATOR
Taking this code: pre ?php define (PATH_SEPARATOR, /); $String=Root/One/Two/Three/Last; $arr = explode ( PATH_SEPARATOR, $String ); var_dump ( $arr ); $arr = explode ( /, $String ); var_dump ( $arr ); ? /pre It works fine in second case returing a five elements array, but in the first one it returns an array with just one elemen that's the source string itself. I've test it also changing PATH_SEPARATOR by SEPARATOR in both cases, and it works nice... Is PATH_SEPARATOR any kind of reserved word or so? Thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] explode and PATH_SEPARATOR
This constant is part of the directory functions. See: http://www.php.net/manual/en/ref.dir.php Araceli. -Original Message- From: Francisco M. Marzoa Alonso [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 5:18 PM To: PHP-General Subject: [PHP] explode and PATH_SEPARATOR Taking this code: pre ?php define (PATH_SEPARATOR, /); $String=Root/One/Two/Three/Last; $arr = explode ( PATH_SEPARATOR, $String ); var_dump ( $arr ); $arr = explode ( /, $String ); var_dump ( $arr ); ? /pre It works fine in second case returing a five elements array, but in the first one it returns an array with just one elemen that's the source string itself. I've test it also changing PATH_SEPARATOR by SEPARATOR in both cases, and it works nice... Is PATH_SEPARATOR any kind of reserved word or so? Thx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] explode and PATH_SEPARATOR
On Nov 15, 2004, at 10:17 AM, Francisco M. Marzoa Alonso wrote: Taking this code: pre ?php define (PATH_SEPARATOR, /); $String=Root/One/Two/Three/Last; $arr = explode ( PATH_SEPARATOR, $String ); var_dump ( $arr ); $arr = explode ( /, $String ); var_dump ( $arr ); ? /pre PATH_SEPARATOR is is a predefined constant, so you'll need to use something else, but you still need to put quotes around it: define('NOT_PATH_SEPARATOR', '/'); -ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php