Page 1 of 1
Gracefull say no to PHP4
Posted: Fri Apr 17, 2009 3:56 am
by greyhoundcode
Is there some way of checking if a script is running under PHP 5, and if not to gracefully display an appropriate error message, "Sorry mate, this script doesn't run on PHP 4."
Re: Gracefull say no to PHP4
Posted: Fri Apr 17, 2009 4:04 am
by requinix
Re: Gracefull say no to PHP4
Posted: Fri Apr 17, 2009 4:08 am
by greyhoundcode
Simple as that eh? I did a little searching and kept getting bumf about phpinfo(), which wasn't what I wanted. Thanks Tazza, owe you a notional beer.
Re: Gracefull say no to PHP4
Posted: Fri Apr 17, 2009 4:16 am
by requinix
In case you didn't notice, there's also the PHP_VERSION constant. Same thing as phpversion(), no function call.
And there's
version_compare, of course.
Re: Gracefull say no to PHP4
Posted: Fri Apr 17, 2009 7:23 am
by greyhoundcode
Yeah I was aware of version_compare(), but PHP_VERSION and phpversion() had eluded me.