MINI PROJECT

How to Create Php Calendar

Awesome Php calendar is fully hard coded in php making full use of php native functions. I have named it awesome because I find this technique very generic and when it can be upgraded and lots of functionalities can be added. This is the first release of this mini project and licensed under MIT(open source). […]

PHP SNIPPET

How to Get Current Page URL using PHP

This php snippet prints current page url. It accepts a Boolean parameter as TRUE/FALSE which acts as a flag for displaying query string. It returns the current site URL.

How to use this function.

PHP SNIPPET

Change Date Format mm/dd/yyyy to yyyy-mm-dd in PHP

One of the common situation I come across often, is to change the date format from mm/dd/yyyy to yyyy-dd-mm. It just take two lines of code to get the results.

You can use an alternative approach also.

PHP SNIPPET

Get IP Address Using PHP

There’s a lot of approach to get ip address in php.  But here’s how I code when I need to get clients Ip address.

Here’s an alternate approach as well,  but I am not sure about this as HTTP_X_FORWARDED_FOR can be anything a client chooses to set, whereas REMOTE_ADDR is considerably harder to fake.

PHP SNIPPET

Get and set timezones in php

If you work with dates and time most of the times, setting up timezones must be your first priority to get accurate results. Using the following snippet you can get and set timezones in php You can find the list of supported timezones from the php official site. To set a timezone use the below snippet.

To […]