How could I detect which version of PHP my PHP script requires? The general version like PHP5 or PHP4 could I know myself, but there are some function which are added not in the minor relase.
+6
A:
One of the ways is:
if (!function_exists('function_name')) {
// the PHP version is not sufficient
}
Raveren
2010-01-25 16:35:11
Since mostly I would guess the issue is PHP 4 and 5, I write a function for php4 that has the same name as a function in 5 with this wrapped around it. Then I can call it as I please.
MrChrister
2010-01-25 16:44:22
I think poru rather wants to know how to determine the minimum PHP version his script can work on. So the lowest PHP version where all the functions he uses are available.
Gumbo
2010-01-25 16:56:04
+2
A:
Pretty much this falls on you, as the developer, knowing what functions you are using and whether they are very new and require newer versions of PHP to run or not. All it takes is one function introduced in a newer version of PHP to make it only as compatible with that version and newer.
John Conde
2010-01-25 16:35:34
+2
A:
Use phpversion() . Also, you can use it to tell the version of an extension, with an optional parameter, phpversion([ string $extension ])
Leprosy
2010-01-25 16:39:37