How to Handle JSON data using PHP

Since JSON appeared on the web, all web services are offering JSON as their primary data format for data interchanging. The reason JSON is so popular is because it is lightweight and easy for humans to read and write. Today I want to show you how we can use this JSON data in our projects using PHP.

PHP Redirect user to new URL

To redirect users to new location, just drop this header() line in your PHP file. Remember that header() function must be called before any actual output is sent, otherwise you might run into error.

How to detect Ajax Request using PHP

If you are using PHP just drop the following line on top of your script, this will detect whether the request was made using Ajax or not.

Set Cookies Get Cookies Delete Cookies with PHP

Cookies are small files created by server on a user computer, cookies are primarily used to store little information about anything, and when user visits your website next time the information stored in cookies can be retrieved and used in various purpose.