Having run the following:
foreach(get_loaded_extensions() as $name){
$extensions[strtolower($name)] = phpversion($name);
}
var_dump($extensions);
I notice that some of the loaded extensions don't show a version, having false instead, for instance:
'pcre' => boolean false
However, when I hit up phpinfo()
, it shows a version number:
Why isn't the phpversion()
function fetching the correct results? I understand in this instance I could simply pull PCRE_VERSION
, but needing to do so for some but not all extensions is silly; gd
shows false too.
Edit: Fix;
foreach(get_loaded_extensions() as $name){
$extensions[strtolower($name)] = phpversion($name);
}
$extensions = array_replace($extensions, array(
'iconv' => ICONV_VERSION,
'pcre' => PCRE_VERSION,
'libxml' => LIBXML_DOTTED_VERSION,
'gd' => GD_VERSION,
// others i may be missing, will get to it
));
Edit: Here's the full dump and the phpinfo()
output, just for giggles:
array
'core' => string '5.3.8' (length=5)
'bcmath' => boolean false
'calendar' => boolean false
'com_dotnet' => string '0.1' (length=3)
'ctype' => boolean false
'date' => string '5.3.8' (length=5)
'ereg' => boolean false
'filter' => string '0.11.0' (length=6)
'ftp' => boolean false
'hash' => string '1.0' (length=3)
'iconv' => boolean false
'json' => string '1.2.1' (length=5)
'mcrypt' => boolean false
'spl' => string '0.2' (length=3)
'odbc' => string '1.0' (length=3)
'pcre' => boolean false
'reflection' => string '$Revision: 313665 $' (length=19)
'session' => boolean false
'standard' => string '5.3.8' (length=5)
'mysqlnd' => string 'mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $' (length=50)
'tokenizer' => string '0.1' (length=3)
'zip' => string '1.9.1' (length=5)
'zlib' => string '1.1' (length=3)
'libxml' => boolean false
'dom' => string '20031129' (length=8)
'pdo' => string '1.0.4dev' (length=8)
'bz2' => boolean false
'simplexml' => string '0.1' (length=3)
'wddx' => boolean false
'xml' => boolean false
'xmlreader' => string '0.1' (length=3)
'xmlwriter' => string '0.1' (length=3)
'apache2handler' => boolean false
'phar' => string '2.0.1' (length=5)
'mbstring' => boolean false
'exif' => string '1.4 $Id: exif.c 314376 2011-08-06 14:47:44Z felipe $' (length=52)
'gd' => boolean false
'gettext' => boolean false
'imap' => boolean false
'mysql' => string '1.0' (length=3)
'mysqli' => string '0.1' (length=3)
'pdo_mysql' => string '1.0.2' (length=5)
'pdo_odbc' => string '1.0.1' (length=5)
'pdo_sqlite' => string '1.0.1' (length=5)
'soap' => boolean false
'sockets' => boolean false
'sqlite' => string '2.0-dev' (length=7)
'sqlite3' => string '0.7-dev' (length=7)
'tidy' => string '2.0' (length=3)
'xmlrpc' => string '0.51' (length=4)
'mhash' => boolean false
'xdebug' => string '2.1.1' (length=5)