whether this code will be executed in case php version is 7.4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
info@prajaktasoftware.com
Forum Newbie
Posts: 2
Joined: Tue May 05, 2020 12:10 am

whether this code will be executed in case php version is 7.4

Post by info@prajaktasoftware.com »

Dear Sir

if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}

I want to know whether this code DONOT ALLOW execution in case PHP verson is > 5.3 and above



complete code

switch (ENVIRONMENT)
{
case 'development':
error_reporting(-1);
ini_set('display_errors', 1);
break;

case 'testing':
case 'production':
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}
break;

default:
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'The application environment is not set correctly.';
exit(1); // EXIT_ERROR
}
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: whether this code will be executed in case php version is 7.4

Post by Benjamin »

No this code does not prevent the execution of the script if the PHP version is greater than or equal to 5.3. It simply sets the level of error reporting based on the version of PHP being used and the value of the ENVIRONMENT constant.
Post Reply