So I've got a script that needs to run on several sites. I've got one version of the script that is optimised with some new PHP 5.3 functions, however some sites are 5.2 etc.
This code:
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
Do the optimised 5.3 code (Although 5.2 throws syntax errors for it)
} else {
do the slower version of code
}
However, on the 5.2 servers, it will detect the "syntax errors" in the first if condition, even though it technically should skip that content, I'm aware that PHP still scans the whole file.
How can I get 5.2 to ignore the first if completely (I know I could use "@" to ignore errors, but that feels like cheating?)