This function safely determines the GD version, even on PHP versions earlier than 4.3 that lack the gd_info() function. Use it to avoid having your script halt with a fatal error if you try to use a TrueColor function and the GD version isn't 2.0 or later.
You can optionally specify a version, but if you specify version 2 it might be overridden. Once the version number is determined it's retained to speed future calls.
* Get which version of GD is installed, if any.
*
* Returns the version (1 or 2) of the GD extension.
*/functiongdVersion($user_ver=0)
{
if (!extension_loaded('gd')) { return; }
static$gd_ver=0;// Just accept the specified setting if it's 1.if ($user_ver==1) {$gd_ver=1; return1; }// Use the static variable if function was called previously.if ($user_ver!=2&&$gd_ver>0) { return$gd_ver; }// Use the gd_in