Ok, this is the oddest thing i have encountered.
I am working on a CMS that provides a template token which renders out some html. I want to obtain that html into a variable and have my way with it. So, im thinking ob_start etc.
Here's the situation:
The template token: [special_section:edition_index]
This renders:
Code:
<a href="/special_section/4/">Answer Book</a><br/><br/>
<a href="/special_section/9/">Home Experts</a><br/><br/>
<a href="/special_section/11/">Young at Heart</a><br/><br/>
<a href="/special_section/28/">Bridal</a><br/><br/>
<a href="/special_section/29/">Complete Wellness</a><br/><br/>
<a href="/special_section/31/">Parade of Homes</a><br/><br/>
<a href="/special_section/37/">Summer Camp</a><br/><br/>
<a href="/special_section/38/">Recreation Services</a><br/><br/>
Here is ALL OF THE CODE:
PHP Code:
<?php ob_start(); ?> [special_section:edition_index] <?php $data=ob_get_contents(); ob_end_clean();
echo 'DATA: '; echo $data;
preg_match_all('/./', $data, $matches); print_r($matches);
Which then outputs:
Code:
DATA: <a href="/special_section/4/">Answer Book</a><br/><br/>
<a href="/special_section/9/">Home Experts</a><br/><br/>
<a href="/special_section/11/">Young at Heart</a><br/><br/>
<a href="/special_section/28/">Bridal</a><br/><br/>
<a href="/special_section/29/">Complete Wellness</a><br/><br/>
<a href="/special_section/31/">Parade of Homes</a><br/><br/>
<a href="/special_section/37/">Summer Camp</a><br/><br/>
<a href="/special_section/38/">Recreation Services</a><br/><br/>
Array
(
[0] => Array
(
[0] =>
[1] =>
[2] => [
[3] => s
[4] => p
[5] => e
[6] => c
[7] => i
[8] => a
[9] => l
[10] => _
[11] => s
[12] => e
[13] => c
[14] => t
[15] => i
[16] => o
[17] => n
[18] => :
[19] => e
[20] => d
[21] => i
[22] => t
[23] => i
[24] => o
[25] => n
[26] => _
[27] => i
[28] => n
[29] => d
[30] => e
[31] => x
[32] => ]
[33] =>
[34] =>
)
)
How in the heck is my $data var showing me one thing when I echo it out, then as soon as I add it to preg_match_all() it reverts to something else????
Any thoughts anyone?
Thanks.
|