Improved PHP version checking logic