I would not say this is a great feature to have in a web application. But many people wanted to learn how the user session of a web application can be ended if the logged in user clicks on the Back button in the browser or refreshes the page. You might have seen this feature implemented in many online banking applications and online ticket booking sites....

The mail function in PHP doesn’t work in Windows/IIS environment unless you set up an SMTP server and configure it. SMTP server now doesn’t come built in with Windows 7 either.
So here is a quick way for you to be able to send mails from your applications and test the mails you send out from PHP or any other applications using SMTP on your localhost....

Often we need to extract a portion of a string specified by a length. When we use the PHP function substr to fetch a part of the string, we can only specify the length of the new string. That means, PHP will cut the string at the specified length and will not worry about words. When you use substr for showing excerpts, it doesn’t look good with...

While coding, many of us want to see a JSON string printed right in the browser in a readable format for easy debugging. In PHP, I usually convert the JSON string back to an Array and use print_r to print the array which throws readable output in the view-source mode. In some cases we really want to print the JSON string formatted. Use the below methods.
I....

You want to compare two arrays in PHP. Basically what you need is to make sure that both the arrays contain the same set of values may or may not be in the same order. You can use the built-in PHP function, array_diff to compute the difference of arrays. But this function just checks whether all the values of array1 is in array2 and if not returns the...

We call it Short Circuit Evaluation (also known as minimal evaluation, or McCarthy evaluation) when a programming language DOES NOT evaluate/execute the second operand in a condition. if the first operand alone can fully determine the outcome of that condition.
We have been using this concept in our codes always. All PHP guys must be familiar with this...

The world is slowly adopting HTML5 and it is time to move towards it. HTML5 incorporates many features which were achievable only using third party plug-ins. I am not talking about HTML5 in detail. I just want to give you some light on a great feature which HTML5 ships with, “Canvas”!
“Canvas” which is an HTML5 tag, allows you...

Being a flash programmer, I have always had this concern. The way a flash application works differs from a php application. We don’t really need to worry about protecting the PHP code because the code is interpreted in the server and only the html codes are sent to the client browser. But a Flash engine basically lies in the user browser and the AS2...

I have an array with many values and I need to do a search to find all the values that match a pattern. We have functions like in_array & array_search in PHP, but these functions basically try to match the exact needle value in the array. I need to use my Regular Expression Pattern and find all the array values that match the regex pattern.
The...

In this tutorial, learn about the get_browser() PHP function and its configuration. We’ll learn how to use Gary Keith’s browser information database (browscap.ini) with the PHP browscap directive.
I wanted one of my web applications to have a different appearance on mobile phones and devices. I didn’t really want to set up an entirely...