Problem when i am using $webRoot / $srvRoot as a value for a variable or in defining a constant
Code & problem is below:
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$thisFile = str_replace('\\','/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$webRoot = str_replace(array($docRoot, 'testing.php'), '', $thisFile);
$srvRoot = str_replace('testing.php', '', $thisFile);
define('WEB_ROOT', $webRoot); //error on this line Variable Undefined
define('SRV_ROOT', $srvRoot); //error on this line Variable Undefined
echo 'thisFile- '.$thisFile ;//works perfect
echo "<br>";
echo 'docRoot- '.$docRoot;//works perfect
echo "<br>";
echo 'webroot- '.$webRoot ;//works perfect
echo "<br>";
echo 'srvroot- '.$srvRoot ;//works perfect
?>
what is it that i am doing wrong?
Pls help me!