Month: January 2014

  • Get only the Domain Name from HTTP_REFERRER in PHP

    $_SERVER[‘HTTP_REFERER’] gives you the URL from where the user came, which is the user’s previous page (whatever page that would appear if the user clicked “Back” in their browser) But $_SERVER[‘HTTP_REFERER’]  gives you the complete URL, something like this : driverstest.info/test/quiz.php?quizgroup=7 If you just want get the domain name .i.e. driverstest.info from the full URL, then you can…

  • Convert Month Numbers to Month Names in PHP

    Here is a lovely bit of code to help you convert months in numbers to proper names! <?php $monthNum = 11; $monthName = date(“F”, mktime(0, 0, 0, $monthNum, 10)); echo $monthName; // Outputs: November ?>