note 444 added to gtk.method.check_version.php
| From: | florian at phpws dot org | Date: | Thu, 12 Aug 2004 17:27:00 +0000 |
| Subject: | note 444 added to gtk.method.check_version.php | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-2574@lists.php.net to get a copy of this message | ||
The gtk::check_version() function checks the underlying GTK+ library version against the version
specified by required_major, required_minor and required_micro. If the library matches the version
it returns nothing (void | none), if the libary is to old, it returns a string like "Gtk+
version too old (micro mismatch)", if the libary is newer, it returns the same string, but
types "too new".
Die funktion gtk::check_version() überprüft die zu grunde liegende GTK+ bibliotheken version,
dei von required_major, required_minor und required_micro angegeben ist.
Wenn die bibliothek der version entspricht, wird nichts zurück gegeben (void | none), wenn die
bibliothek zu alt ist, wird ein string ähnlich "Gtk+ version too old (micro mismatch)"
zurückgegeben, wenn die bibliothek zu neu ist, wird der gleiche string zurückgegeben, anstatt
"too old" aber mit "too new".
<?php
// Here is an function, to check that the version is newer than version $v1 and older then version
$v2
// If version is newer, it returns TRUE, otherwise FALSE..
// This is usable if you know that you need version $v1 but it doesnt work since $v2..
function gtk_check_version($v1major, $v1minor, $v1micro, $v2major, $v2minor, $v2micro)
{
$result1 = gtk::check_version($v1major, $v1minor, $v1micro);
$result2 = gtk::check_version($v2major, $v2minor, $v2micro);
if( strstr($result2, 'old') && !strstr($result1, 'old'))
{
return TRUE;
}
return FALSE;
}
//Now we want to check that it is minmal version 1.2.1 but not version 1.3.0 or newer
if( gtk_check_version(1,2,1, 1,3,0) )
print "It is older than 1.3.0 but newer than or matching 1.2.1!\n";
else
print "It doesnt match our 1st conditions!\n\n";
//Now we want to check that it is minimal version 1.3.0 but not version 2.0.0 or newer
if( gtk_check_version(1,3,0, 2,0,0) )
print "It is older than 2.0.0 but newer than or matching 1.3.0!\n";
else
print "It doesnt match our 2nd conditions!";
?>
http://gtk.php.net:80/manual/en/gtk.method.check_version.php