PHP Functions

A function is a block of code that takes more than one input in the form of a parameter, processes it, and then returns a value. There are two types of PHP functions: Built-in Functions User defined functions PHP Functions: Built-in To do a given operation, PHP includes over 1000 built-in functions that may be … Read more

PHP Superglobal Variables

As we have discussed PHP Global variables. Some PHP variables are “superglobals,” which means they are always reachable, irrespective of scope, and can be accessed from any function, class, or file without doing anything special. PHP Superglobal Variables The superglobals can be found all across your script. These variables can be accessed from any function, … Read more

PHP Cookie

A PHP cookie is a tiny file that the web server saves on the client computer, with a maximum size of 4KB. The cookie will be sent each time the same computer requests a page through a browser. They are often used to store track of information like a username that the site can use to … Read more

PHP Regular Expressions

Regular expressions are nothing more than a string of characters in a particular order. Regular Expressions (“regex” or “RegExp”) are specifically designed text strings that are used to find patterns in text. To generate complex expressions, regular expressions use arithmetic operators like (+,-,). They may assist you with activities such as validating email addresses and … Read more

PHP Session

A session is a frame of communication between two mediums. PHP sessions are used to temporarily store and transmit information from one page to another (until the user close the website). Problem:  The HTTP address does not keep state, So the web server has no idea who you are or what you do. Solution: Session variables … Read more

PHP Form Methods

For uploading data some PHP Form Methods are used such as Get or Post. These methods are written as value of method attribute and specifies the HTTP method to be used when submitting the form data. Both GET and POST are treated as $_GET and $_POST. These are superglobals, which means that they are always … Read more

PHP Date and Time

Whenever conducting SQL queries or constructing a website PHP date and time are two of the most commonly used functions in PHP. For these purposes, PHP provides predefined functions. The following sections go over some of PHP’s built-in date and time capabilities. PHP date() Function A timestamp is converted to a more readable date and … Read more

PHP File Upload

We’ll learn about the PHP file upload process in this chapter. With just a few lines of code, PHP allows you to upload single or many files. Configure The “php.ini” File First, make sure PHP is set up to accept file uploads. Look for the file uploads directive in your “php.ini” file and turn it on. … Read more

PHP Form Handling

Form data is collected using the PHP superglobals $_GET and $_POST. PHP Form Handling-Simple HTML Form A simple HTML form with two input boxes and a submit button is shown below: In the above example, when a user fills out the form and clicks the submit button, the information is transferred to a PHP file … Read more

PHP Include and Require

In this chapter we will study PHP include and require functions: Problem: As we all know, PHP allows us to develop a variety of functions and elements that can be reused across multiple pages. Scripting the same function across numerous pages takes a lot of time and work. Solution: File inclusion is the solution. It … Read more