Re: pathinfo function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 26, 2011 at 3:47 PM, Tim Streater <tim@xxxxxxxxxxxxxxxx> wrote:
> that I will get an error if I try to reference $info["extension"] ??

>From what I can tell via reading the docs:

"The following associative array elements are returned: dirname,
basename, extension (if any), and filename."
<http://php.net/pathinfo>

Makes me think that if the extension does not exist, then the
"extension" key will not exist.

Looking like isset() (or array_key_exists) will be needed:

$foo = (isset($info['extension'])) ? $info['extension'] : '';

At least, that's my take on it. :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux