So I'm trying to take out all the text in my html page between the elements of <!-- START_CAPTURE_1 --> and <!-- END_CAPTURE_1 -->
So far I'm using a preg_split.
... this gives me a series of arrays, which I'm trying to access and then do a simple index subtraction to find all the text between my two CAPTURE elements. Then I'll probably use stristr to parse out the text in the middle.
I'm having a problem with accessing the arrays within the $start and $end arrays though. The $start array is given back to me as
... but I'm having a simple problem in accessing the second element of the second array ie. the value 34.
I've tried the obvious $start[1].Array[2] but no luck. What's the name of that second array ?
I guess I could try to access each element in turn with two for loops, but I'd rather not have to. Anyone any ideas ?
Also, is there an easier way to do this whole thing ? I can't find any php function that suits my needs exactly. Am I missing something ?
So far I'm using a preg_split.
Code:
$start = preg_split("/<!-- START_CAPTURE_1 -->/", $html_page_text, -1, PREG_SPLIT_OFFSET_CAPTURE);
$end = preg_split("/<!-- END_CAPTURE_1 -->/", $html_page_text, -1, PREG_SPLIT_OFFSET_CAPTURE);
I'm having a problem with accessing the arrays within the $start and $end arrays though. The $start array is given back to me as
Code:
array(2) {
[0]=> array(2) {
[0]=> string(0) "" [1]=> int(0) }
[1]=> array(2) {
[0]=> string(56) "HTML_TEXT_THAT_I_WANT" [1]=> int(34)
}
}
I've tried the obvious $start[1].Array[2] but no luck. What's the name of that second array ?
I guess I could try to access each element in turn with two for loops, but I'd rather not have to. Anyone any ideas ?
Also, is there an easier way to do this whole thing ? I can't find any php function that suits my needs exactly. Am I missing something ?