<?php
error_reporting(E_ALL);
echo 'Testing on PHP version ' . PHP_VERSION . PHP_EOL . PHP_EOL;
#sleep(1);
echo 'Checking if __DIR__ is defined...' . PHP_EOL;
if (!defined('__DIR__')) {
#sleep(2);
echo 'Nope, defined() returned (bool)false.' . PHP_EOL;
echo 'So, seems like the magic constant __DIR__ is not defined.' . PHP_EOL . PHP_EOL;
#sleep(2);
echo 'No prob. Executing define(\'__DIR__\', \'/foo/bar\')...' . PHP_EOL;
define('__DIR__', '/foo/bar');
#sleep(1);
echo 'Done, defined __DIR__ as "/foo/bar".' . PHP_EOL . PHP_EOL;
#sleep(1);
echo 'Double-checking __DIR__ is defined now...' . PHP_EOL;
#sleep(2);
if (!defined('__DIR__')) {
echo 'WTF, defined(\'__DIR__\') again returned (bool)false?!' . PHP_EOL;
} else{
echo 'Strike, this time defined(\'__DIR__\') returned (bool)true.' . PHP_EOL;
echo 'So, seems like __DIR__ was successfully defined. :)' . PHP_EOL . PHP_EOL;
}
} else{
echo 'Yep, defined(\'__DIR__\') returned (bool)true.' . PHP_EOL;
echo 'The magic constant __DIR__ seems to be defined.' . PHP_EOL . PHP_EOL;
}
#sleep(2);
echo 'Finally, here is the result of var_dump(__DIR__):' . PHP_EOL;
var_dump(__DIR__);