I've a strange comportement while i'm trying to detect if HTTPS is enabled or not:
$ssl=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
$expected=$ssl.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $ssl.'<br/>';
echo $ssl.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'<br/>';
echo $ssl.'<br/>';
echo $ssl.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'<br/>';
The result:
http
https://<MYDOMAIN>/beta/test.php
http
http<MYDOMAIN>/beta/test.php
Why, on the second line, it says httpS but just before and after http ?
Running PHP: 7.4.20 (OPcache enabled)
Thank you