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

}

This code does not belong at all. Error reporting settings are done in the php.ini.

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

    To answer your question: no, the code will run in either case -- the if/else block just controls what the error-reporting settings are while it runs. Whether or not those are the settings you really want to use in your particular case (and whether they should be set here or elsewhere) is another issue. 😉

      Write a Reply...