Different web servers might implement standard, or even non-standard, environment variables that communicate the SSL status to PHP. Therefore, relying on
$_SERVER[‘HTTPS’] might not always be very reliable. Luckily there are ways to work around the problem and work out a solution that works best for the environment you are working in. Read the article to gain a better understanding of the options you might have to determine whether a page was accessed securely via SSL/TLS or not.
Read about the different ways you can convert a variable (such as a scalar type, resource,
null, or an object) into an array quickly and easily. We also look at the effects of each method on an existing array and the result it yields.