PHP: Auto-loading files in PHP

Let’s discuss why files auto-loading is required specially for beginners. If you have many classes, then you need to write as many require statements as many files you need which does not seems to be nice. The solution is php’s built-in functions: spl_autoload_register and __autoload. Folder Structure: Step 1: Create a file for class A… Read More »

Use any browser window as notepad

Sometimes we just need to write down some information temporary while internet browsing. All you need to do is just type the following code into the browser’s URL bar:

Hit Enter, and start typing away directly in your browser window. All this is possible due to the new contenteditable attribute of HTML5. The contenteditable… Read More »

What is Transmission Control Protocol/Internet Protocol (TCP/IP)?

Transmission Control Protocol/Internet Protocol(TCP/IP) is a set of rules (protocols) governing communications among all computers on the Internet. TCP/IP was developed in 1978 and driven by Bob Kahn and Vint Cerf. TCP/IP is a combination of two main protocols among the suite of protocols: Transmission Control Protocol (TCP) and Internet Protocol (IP). Two things are… Read More »

Difference between Internet and World Wide Web

The terms Internet and World Wide Web(WWW) are often used without much distinction, but these two are not same. The Internet is a global system of interconnected computer networks that use the Internet protocol suite (TCP/IP) to link billions of devices worldwide. In other words, Internet is a network of networks. The World Wide Web… Read More »

MySQL: DISTINCT clause and its use

There are many cases where we get duplicate rows in the result set. We can remove these duplicate rows using DISTINCT clause in the SELECT statement. NOTE: DISTINCT clause must be the first in the SELECT list. Before we start, we need some data on which we perform DISTINCT clause queries. Table: users

Data:… Read More »

MySQL: GROUP BY clause

GROUP BY clause is used to group values from a column(s). Many calculations can be performed on grouped values of that column(s). AGGREGATE functions (like COUNT, SUM, AVG, etc., functions) can be used on the grouped column(s). Let’s discuss GROUP BY in details. But, before we need to create data on which we shall run… Read More »

MySql: Query related to fetch (N)th maximum salary

Hi All, Here we shall discuss some queries related to nth maximum salary among the employees. Let’s create a table “emp” first:

Now, insert some data in table “emp“:

Get (N)th highest salary of employee using LIMIT:

Get (N)th highest salary of employee without using LIMIT:

Other ways to get the… Read More »

PHP: What is the difference between single-quoted and double-quoted strings?

Hi All, We use single or double quotes in programming whenever we need to specify a string. But, there are very interesting differences in using single and double quotes. Lets discuss the difference between them and which should be used when. Single Quoted Strings: Single quoted strings are the easiest way to specify string. Single… Read More »

PHP: An Introduction to Cookies

What is Cookie? You can consider cookies as text files, which are saved to client’s machine. On the request of a web-server, client’s browser creates such a file. Now, the web-server can read and write content from and to this file. Although, it seems not safe as no one like someone writing files to their… Read More »