
$length is an optional parameter of the PHP substring function and it specifies the length of the string to be cut.

The syntax of the substr() function contains three parameters, $string, $start and $length, in which the first two are mandatory, and the last one is optional.

The PHP substring has the following syntax.
#Php substring extract how to#
Here we will discuss how to extract a substring from a string in PHP using Substr(). The PHP substring function accepts a string and returns a substring from the string. PHP substring, also known as PHP Substr(), is the most common PHP string function and it is used to extract a part of a string.

PHP offers a variety of functions, including the PHP substring function, to make it easy to work with different data types. Advance Microsoft Office Package Training.Red Hat Certified Engineer RHCE Training.Quality Assurance and Quality Control(QA & QC).
