// Logs. Values are 0 for disabled and 1 for enabled.
define('logs', 'test');

// Display logs status.
switch(logs) {
    case 0:
        echo 'Logs are disabled.' . PHP_EOL;
        break;

    case 1:
        echo 'Logs are enabled.' . PHP_EOL;
        echo 'Location: ' . path . '\var\mailer.log' . PHP_EOL;
        break;

    default:
        echo 'Value not recognised.';
        break;
}

I was expecting as I defined the value for logs to echo the default case because it does not match 'test' value with 0 and 1 but is displaying the case 0 message.

If I change values for 0 to off and case 1 to on and I use words is working properly but for some reasons using numbers is not working.

0 Answers