Page 1 of 1

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

Posted: Sun Dec 25, 2022 12:38 am
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
}

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

Posted: Tue Dec 27, 2022 5:32 pm
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.