Author: Saim Khalid
-
Comparison Operators
In PHP, Comparison operators are used to compare two values and determine their relationship. These operators return a Boolean value, either True or False, based on the result of the comparison. The following table highlights the comparison operators that are supported by PHP. Assume variable $a holds 10 and variable $b holds 20, then −…
-
Arithmetic Operators Examples
In PHP, arithmetic operators are used to perform mathematical operations on numeric values. The following table highlights the arithmetic operators that are supported by PHP. Assume variable “$a” holds 42 and variable “$b” holds 20 − Operator Description Example + Adds two operands $a + $b = 62 – Subtracts the second operand from the…
-
Operators Types
What are Operators in PHP? As in any programming language, PHP also has operators which are symbols (sometimes keywords) that are predefined to perform certain commonly required operations on one or more operands. hey are used to do calculations, compare values and make decisions in code. They are important for writing good programs. For example, using…
-
Return Type Declarations
PHP version 7 extends the scalar type declaration feature to the return value of a function also. As per this new provision, the return type declaration specifies the type of value that a function should return. We can declare the following types for return types − To implement the return type declaration, a function is…
-
Scalar Type Declarations
The feature of providing type hints has been in PHP since version 5. Type hinting refers to the practice of providing the data type of a parameter in the function definition. Before PHP 7, it was possible to use only the array, callable, and class for type hints in a function. PHP 7 onward, you can also…
-
Date & Time
The built-in library of PHP has a wide range of functions that helps in programmatically handling and manipulating date and time information. Date and Time objects in PHP can be created by passing in a string presentation of date/time information, or from the current system’s time. PHP provides the DateTime class that defines a number…
-
MySQL Login
MySQL is a popular choice as a backend database for PHP powered web applications. In this chapter, we shall learn to develop a login page for a PHP application that authenticates the given username and password. You should have a web server having PHP and MySQL installed for experimenting with the example discussed in this…
-
Paypal Integration
PayPal is a payment processing system. We can integrate PayPal with websites by using with PHP. PayPal Integration File System PayPal integration file system included four files as shown below − The user has to download a PayPal SDK file from here and exact a zip file. The zip file contains four PHP files. We…
-
Facebook Login
Users can be asked to log into a web application with the help of Social media login, also called SSO. This way users need not create a new account. Instead, users can use their existing social media account information to log in. Some examples of social media login include: Google, Facebook, LinkedIn, Apple. In this…
-
Login Example
A typical PHP web application authenticates the user before logging in, by asking his credentials such as username and password. The credentials are then checked against the user data available with the server. In this example, the user data is available in the form of an associative array. The following PHP Login script is explained below − HTML…