Substring in php Example

Substring:

If you want to extract substring from a given string then use the

Syntax:

substr($string_input,$int_start,$int_length)

Example:

substr(‘God is love’,7,4);

Program: substring.php

<?php
print substr('god is love',7,4);
print substr("god is love",7,4);
print substr('8124066089',5,4);
print substr("8124066089",5,4);
?>

 

Output:

substring

 

 

Thanks for reading this post………..!!!

Leave a Reply