How can I grap text from a middle of string which begin and end are static?
For example I have string: BEGING some text here END And I would like to get 'some text here' to different string
Thanks for your help
this is probably not the cleanest way of doing it, but try this:
preg_match("/BEGIN/",$string,$first_match); preg_match("/END/",$first_match[0],$final_match); $final_string = $final_match[0];
Why not simply :
<? $replace_what = array("BEGIN", "END"); $final_string = str_replace($replace_what, "", $string); ?>
???
oooh.. pretty, I didn't know you can feed an array into str_replace!