PHP

How to convert date to timestamp in PHP example

How to convert date to timestamp in PHP example

In this article lets understand how to convert date to timestamp in PHP example. There are two methods to do so as below : This methods allows to covert date to Unix timestamp. Lets check them with example : 1. Using strtotime() This function converts string date format to Unix timestamp, this is built in …

Php operators and examples

Php operators and examples

In this article lets understand php operators and its examples. Operators in PHP are symbols that works with variable to perform various operations. PHP supports many operators and we an categorize them from how it functions as below: 1. Arithmetic Operators 2. Assignment Operators 3. Comparison Operators Comparison operators in PHP are used to compare …

PHP - substr examples

PHP – substr examples

In this article lets explore substr examples in PHP. We can use substr in many ways in PHP. Let’s check through examples what we can do using this function. The basic syntax is as below : 1. Get substring from the middle of a string : Check below code snippet to get substring from a …

How to check if string starts with in PHP

How to check if string starts with in PHP

In this article lets understand how to check if string starts with in PHP. PHP provides many ways to find out if a string starts with any other specific string, let’s explore them. Among various versions of PHP the latest adds new functions which provides simple way to do so. PHP version 8 or greater …

PHP implode and explode function with example

PHP implode and explode function with example

In this article lets understand how to use PHP implode and explode function with example here. Implode and explode functions are used for the purpose like creating array from string and/or creating string from array. Let us understand it step by step with it’s definitions, parameters and examples. 1.  explode() function Syntax : Return Type: …

What are the differences in die() and exit() in PHP

What are the differences in die() and exit() in PHP?

In this article lets understand what are the differences in die() and exit() in PHP. In PHP, both die() and exit() are used to terminate the execution of a script, but they are essentially the same function with different names. They can be used interchangeably without any functional difference. Here are some key points regarding …