Gracefull say no to PHP4
Moderator: General Moderators
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Gracefull say no to PHP4
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."
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Gracefull say no to PHP4
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.
Code: Select all
phpversion();Re: Gracefull say no to PHP4
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.
And there's version_compare, of course.
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Gracefull say no to PHP4
Yeah I was aware of version_compare(), but PHP_VERSION and phpversion() had eluded me.