Home » PHP String Operations | PHP substr, PHP strlen, PHP str_replace, PHP Cast, escape_string

PHP String Functions| PHP substr, PHP strlen, PHP str_replace, PHP Cast, escape_string

When we start working with PHP String functions, we have to learn some useful PHP String operation using PHP predefined functions. Today we talk about some most used PHP functions which use to manipulate PHP strings. Here are some we defined or explained with an example. There are 5 most used PHP string manipulation functions listed below:

PHP String functions

Complete Explanation of PHP String functions

1. Substr in PHP (PHP substr())

Substr in PHP, also on the full form is called PHP substring. In PHP substring we cut out some part of the string from where we want. Using PHP substr(), in this function, we pass the required parameter than execute for getting the result. Below check the syntax of the PHP substr() function.
substr(string_name, start_position, string_length_to_cut)
PHP substr() Example:

2. PHP String Length (PHP strlen())

Using PHP strlen() function we can get the length of the string.
PHP strlen() Example:

3. PHP String Replace (php str_replace, php regex replace)

In PHP, if we want replace any particular string, any integer or any type of data we use php str_replace() function. Example shown below.

PHP str_replace() Example:

4. PHP String Cast

User Editor to check the O/P: Click Here

5. PHP Escape String (escape_string PHP)

Know more about PHP String functions, check the PHP official site,


Happy Coding..!

Was this article helpful?


Leave a Reply

Your email address will not be published. Required fields are marked *