Category PHP

PHP strpos() Function: Syntax, Examples

The strpos() function in PHP is a built-in function which is used to find the position of the first occurrence of a substring within another string. If the substring is found, the function returns the index (i.e. numeric position) of…

Substring in PHP with substr() Function

A substring in PHP or any other programming language, is a portion or segment of a string. For example, a substring might be “PHP” or “Welcome” in the string “Welcome to PHP!”. We often perform substring operation to extract specific…

PHP ltrim() and rtrim() Functions with Examples

In this tutorial, we will learn about ltrim() and rtrim() functions in PHP with the help of examples. Let’s begin understanding about the ltrim() function. PHP ltrim() Function The ltrim() function in PHP is a built-in function which is used…

PHP trim() Function: Syntax, Examples

The trim() function is a built-in function in PHP which is used to remove white space or other specified characters from the beginning and end of the string. This function simply removes unwanted characters (like whitespace, tabs, newlines, etc.) from…