Reputation: 33
how do I output the results while replacing the cumbersome bracket tags?
instead of [3] => 56531631380
i want @56531631380& for all items
<?php
$f = fopen ('http://fanpagelist.com/category/top_users/view/list/sort/fans/page1', 'r');
$page = '';
while ($line = fgets($f)) {
$page .= $line;
}
fclose ($f);
preg_match_all('#(?:(?<=\bhref="/like_box\.php\?id=)|' .
'(?<=\bsrc="https://graph\.facebook\.com/))\d+#i',
$page, $result, PREG_PATTERN_ORDER);
print_r ($result);
?>
<pre>
<?php
echo preg_replace("/\([^)]+\)/","",$result);
?>
</pre>
Upvotes: 0
Views: 88
Reputation: 173
Use a foreach loop to loop through the array $results:
foreach ($results as $r) {
echo "@" . $r . "&";
}
Upvotes: 1