| Start |
|---|
| Splitting a string by separators
A string containing several parts of text that are separated by a common character can be split into parts with the The method also supports a limit parameter that can be used as follow: If the limit parameter is zero, then this is treated as 1. If limit is set and positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string. If the limit parameter is negative, all components except the last -limit are returned.
However, make sure that the result of
|
| Searching a substring with strpos
Checking if a substring existsBe careful with checking against TRUE or FALSE because if a index of 0 is returned an if statement will see this as FALSE. Output of the whole example: Search starting from an offsetGet all occurrences of a substring |
Get all occurrences of a substring |
| Parsing string using regular expressions preg_match can be used to parse string using regular expression. The parts of expression enclosed in parenthesis are called subpatterns and with them you can pick individual parts of the string. Output RemarksRegex should be used for other uses besides getting strings out of strings or otherwise cutting strings into pieces. |
Read Article
https://develop.horje.com/learn/1434/reference