Folks,
Not gonna beat round the bush anymore.
Gonna ask you direct.
How to extract what is inside brackets providing certain chars exist inside the brackets ?
[code]
Bog Off!
code]
Get Lost!
[/code]
Look at the two above brackets. Imagine I only want to extract what is inside the brackets if the pattern “g o” exist. If condition met. In this example, everything inbetween
[code] and
from the first set should be dumped into $extract = array().
How to do this ?
Ok dumping into array not that hard but how to get PHP to:
1. Check what is inbetween two tags or what is inbetween two chars and2. How to extract all data from within the two tags.Opening tag and closing tag. Or two chars ?
Imagine, I got this string:
>
Gonna kick your backside to Kingdom Come you King Kong!
Now imagine, I want to dump into array all chars that are in-between the “Gonna” and “to” (opening word and closing word). Which PHP function to use ? Don’t tell me Knees to use a bunch of functions more than one. substring, implode, explode, str_pos etc. Too much headache to do things the long way.