|
|
|
| Title : |
This functions compares the current PHP version with a
desired version. Because of the 3 tiered version system, a
direct compare of a string to phpversion() will not be
accurate. |
| Categories : |
PHP Configuration, PHP, Variables |
 Brian Moon |
| Date : |
Apr 16th 1999 |
| Grade : |
2 of 5 (graded 2 times) |
| Viewed : |
6266 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Brian Moon |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
<?PHP
function phpvercmp($minver){
$minver=explode(".", $minver);
$cnt=count($minver);
// find max digits in one portion
for($x=0;$x<3;$x++){
$len=strlen($minver[$x]);
if($pad<$len) $pad=$len;
}
$phpver=explode(".", phpversion());
// find max digits in one portion
for($x=0;$x<3;$x++){
$len=strlen($phpver[$x]);
if($pad<$len) $pad=$len;
}
$minver=sprintf("%0".$pad."d%0".$pad."d%0".$pad."d", $minver[0], $minver[1], $minver[2]);
$phpver=sprintf("%0".$pad."d%0".$pad."d%0".$pad."d", $phpver[0], $phpver[1], $phpver[2]);
echo "$minver<br>$phpver<p>";
if($phpver>=$minver){
return true;
}
else{
return false;
}
}
?> |
|
| The following snippet gives complete info about all submitted
HTTP_POST_VARS and HTTP_GET_VARS Categories : Variables, HTTP, PHP | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Why do i get a "Save As" dialog box when I type in the url of a php3 file Categories : PHP Configuration, PHP, Apache, Web Servers | | | How to display a PHP variable value from a selectbox without reloading the
page by merging PHP and Javascript variables. Categories : PHP, Java Script, Variables | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | translate.php - Assocciative array example, passing a reference to a function. Categories : PHP, Arrays, Languages, Variables | | | How can i see the path of the php3.ini file my php3 uses? Categories : PHP, PHP Configuration | | | getting the name of the current script and query string Categories : PHP, Global Variables, Variables, URLs | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | What is safemode? Categories : PHP, Installation, PHP Configuration | | | Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem | | | How to control the number of decimal places when outputting numbers. Categories : PHP, Strings, Variables | | | Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP, Beginner Guides, Variables | | | A quick way set data from a form to a function or other places where you can lose scope. Categories : PHP, HTML and PHP, Variables | |
|
|
|