I'm pretty new to PHP (specifically), so I apologize if I'm missing something obvious. At least this should be a pretty quick question.
Ok, so I have the following test code set up:
I'm running it on my development server, which is a Windows machine running IIS 7 with PHP 5.6, on localhost, obviously not over HTTPS. Under those circumstances, the value of $secure should be false. But for some reason, the echo code above consistently returns, "FalseEmpty" - even though I specifically checked for empty and reset it to false. Does false somehow = empty in PHP? If not (and that would be very strange), how do I get it to correctly set to false based on the server settings?
Many thanks!
Katie
Ok, so I have the following test code set up:
PHP:
$secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
$secure = (empty($secure)) ? false : $secure;
echo ($secure ? 'True' : 'False'), empty($secure) ? 'Empty' : '';
I'm running it on my development server, which is a Windows machine running IIS 7 with PHP 5.6, on localhost, obviously not over HTTPS. Under those circumstances, the value of $secure should be false. But for some reason, the echo code above consistently returns, "FalseEmpty" - even though I specifically checked for empty and reset it to false. Does false somehow = empty in PHP? If not (and that would be very strange), how do I get it to correctly set to false based on the server settings?
Many thanks!
Katie