My application is using the following code to detect mysql higher than 5. It works well with PHP 5.2, 5.3 and 5.4.
The trouble is with PHP 5.5 which uses mysqlnd by default so the script reports mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $ and cannot detect MySQL properly. I need to make an exception for such version, but I don't know how to.
echo "<mysql>";
if(key_exists('mysql', $phpinfo))
{
if(key_exists('Client API version', $phpinfo['mysql']))
{
$t=explode(".", $phpinfo['mysql']['Client API version']);
if($t[0]>=5)
$ok=1;
else
$ok=0;
echo "<val>{$phpinfo['mysql']['Client API version']}</val><ok>$ok</ok>";
}
else
echo "<val></val><ok>0</ok>";
}
else
echo "<val></val><ok>0</ok>";
echo "</mysql>\n";