Changes

Jump to: navigation, search

Working with Strings and Text in PHP

12 bytes removed, 17:13, 4 June 2007
Extracting and Replacing Substrings in PHP
The above example will extract the word ''cat'' from the string.
The substr_replace function takes up to four arguments. The firsdt first is the source string on which the replace is to be performed. The second argument is the replacement string. The third argument specifies the index offset of the starty start of the replacement. The optional fourth argument defines number of characters from tyhe offset point to include in the replacement (useful if your replacement text is shorter than the original text being replaced). 
We can nopw extend our example to replace some text in our string:

Navigation menu