Core Function Between
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> Between( <haystack>, <firstneedle>, <secondneedle>, <case> ) </pre> === Description === Return the text between a start and end substring. === Parameters === ==== hayst...") |
m (1 revision) |
||
(2 intermediate revisions by one user not shown) | |||
Line 16: | Line 16: | ||
The first substring to find | The first substring to find | ||
− | |||
==== secondneedle ==== | ==== secondneedle ==== |
Latest revision as of 12:37, 14 June 2015
Between( <haystack>, <firstneedle>, <secondneedle>, <case> )
Contents |
Description
Return the text between a start and end substring.
Parameters
haystack
The search to search for the substrings
firstneedle
The first substring to find
secondneedle
The second substring to find
Return Value
Success: Returns the between between the first and second substrings.
Failure: Returns empty string.
Remarks
None
Example
// String search $str = "The quick brown fox jumps over the lazy dog"; $val = Between($str, "brown", "over"); echo "'$val'\n"; // Prints fox jumps // Character search $str = "The"; $val = Between($str, "T", "e"); echo "'$val'\n"; // Prints h // Case insensitive $str = "The"; $val = Between($str, "t", "e", true); echo "'$val'\n"; // Prints h