Re: How can I replace $_SERVER["DOCUMENT_ROOT"] in PHP 7.0?
| From: | Bo Berglund | Date: | Wed, 15 Sep 2021 10:51:49 +0000 |
| Subject: | Re: How can I replace $_SERVER["DOCUMENT_ROOT"] in PHP 7.0? | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327698@lists.php.net to get a copy of this message | ||
On Wed, 15 Sep 2021 10:38:58 +0100, Ashley Sheridan <ash@ashleysheridan.co.uk>
wrote:
>>> No, $_SERVER['DOCUMENT_ROOT'] is a string, just echo out what it
>>> actually is on both versions of PHP. That would show you what you now
>>> know, that it's different for whatever reason. It could be a script
>>> being run that's altering it, it could be a change in server config, not
>>> easy to tell without more digging.
>> Does it matter if I use
>> $_SERVER["DOCUMENT_ROOT"] rather than
>> $_SERVER['DOCUMENT_ROOT']
>>
>> In the code I am struggling with it uses double quotes rather than single quotes
>> as you show here,
>>
>The only difference between single and double quote is how PHP handles
>string interpolation, e.g.:
>
>$var = 'something';
>echo "this is $var";
>echo 'this is $var';
>
>Will give you the output:
>
>this is something
>this is $var
So that works like bash in shellscripts then!
Good to know.
--
Bo Berglund
Developer in Sweden