Alicia Collins
Alicia Collins

Reputation: 33

outputting results without bracket tags

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

Answers (1)

HockeyRef45
HockeyRef45

Reputation: 173

Use a foreach loop to loop through the array $results:

foreach ($results as $r) {
    echo "@" . $r . "&";
}

Upvotes: 1

Related Questions