Php stristr
From w3cyberlearnings
Contents |
PHP function stristr
This function returns the search result of the first occurrence of a string inside another string.
Syntax stristr
- string: string input.
- search: string to search (Can also use the ASCII value)
stristr(string,search);
Return
- When found: return the rest of the string from the matching point.
- When not found: Return false.
Example 1
<?php echo stristr("Good old day, all boys need to pray before go to bed.", "boys"); ?>
Output
boys need to pray before go to bed.
Example 2
- ord('a')=97 to get the ASCII value.
<?php echo stristr("lots of banana sale here!",97); ?>
Output
anana sale here!