Suppose we have a string variable: $str = "How old are you, little monster?" We want to extract the string placed between the characters ',' and '?'. Please write a PHP program to achieve this
input string="How old are you,little monster?"
output string= How old are you,little monster
To extract the given string in PHP, i will use built-in function substr() function,
syntax: substr(stringname,start,length)
following is the Php code:
<?php
// variable declaration!"
$str = "How old are you, little monster?";
echo substr($str, 0, 31);
?>
output
**please give your honest feedback for encouragement**
thank you.....!
Get Answers For Free
Most questions answered within 1 hours.