Category: PHP

PHP tutorials

PHP MVC: Model, View, Controller

In PHP, MVC is the collation of three core parts: Model, View, and Controller. The visual representation of MVC is: The controller is the mediator between the model and view. MVC framework hides the complex implementation details of applications. It also increases the productivity of developers by basic implementations such as database connection, etc. are […]

PHP Mail Function: Simple mail, HTML mail

PHP Mail In PHP, the mail function is used to send emails directly from the script. The mail function in PHP accepts these parameters. Email address Subject Message PHP must be configured correctly in the php.ini file with the details of how your system sends an email. Syntax for PHP mail function is: Here, to is the […]

PHP Regular Expressions

Regular Expressions: In PHP, regular expressions are a pattern that is used to match various text string. For effective & efficient text processing and manipulation, regular expressions are one of the most powerful tools. For example, it can be used to check the format of data in a phone number, email, name, etc. The regular […]

PHP date functions: date, time, maketime

The date functions The date function is an in-built function in PHP which takes zero or more arguments and based on that it provides the date in a human-readable format. The date function allows you to display format and manipulate date and time on the server using date function and PHP date format. Syntax:- The […]

Functions and types of functions in PHP

In PHP, function is a collection of logically related statements that are used to perform specific task. In PHP, there are thousands of built-in functions to perform various task. In this, we will go through:- Built-in Functions String Functions Numeric Functions Date Functions User-Defined Functions Function Uses Function is useful when it is required to […]

PHP Loops: for, foreach, while, do…while

In PHP loops, are used to execute the certain portion of the code number of times until certain condition are met. The types of loops are: for for…each while do…while For Loop In PHP, for loop is used to perform some tasks repeatedly for a specific number of times. For loop is used, when you […]

PHP Control Structures

In PHP, control statements are divided in two categories: Conditional Structure Looping Structure We will here discuss the conditional structure. We will cover the looping structure in the next tutorial Conditional Structure: Conditional Structure will test the condition or expression & based on the result it will allow us to control the execution of the […]

PHP Error Handling: die, Custom error handler, Error reporting

Error is generated in the script whenever something went wrong with the code. To handle errors in the script, a built-in error handler mechanism in PHP stops the execution of the script, and display an error message. It will display the following information: Error Type Detailed Error Message File Name Line Number Whenever a web […]

PHP File Processing: fopen, fread, fwrite file_exists

PHP File Function To store information on the computer we create a file. This file stores various types of information such as simple text, images, configuration settings of the program, etc. PHP supports various functions to work with these files. This file functions allow you to create the file, open the file, reading contents of […]

PHP Cookies and Session

Cookies In PHP, cookies is the small piece of information that the server embeds on the client’s computer. If users request the webpage from the browser, the cookie will also be sent with that. It is used to track user’s activity in the browser. A Cookie also has name and value. A Cookie stores user-specific […]