How to detect HTTPS SSL

You can detect HTTPS with the code line below in PHP

if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')
{
     //Your code here
}