i need to print each element in array ,i wrote code in php .i need that in line : echo $line . "<br />"; i see each element in array but i see a problem convert it to string. <?php $website="https://www.tradebit.com/filesharing.php/1010-Documents-eBooks-Audio-Books-Teaching"; //echo $website ; $content=file_get_contents($website); preg_match_all("/<a href=\"([^\"]*)\">(.*)<\/a>/iU",$content,$result); //print_r($result); foreach ($result as $line ){ echo $line . "<br />"; } ?> Code (markup):
what you have should be fine but you could try something like this too foreach($result as $line){ echo "{$line}<br />"; } Code (markup): The docs for preg_match_all state that $result[1] will actually hold the information that you need - but in another array so your code should be foreach($result[1] as $line){ echo "{$line}<br />"; } Code (markup): and if you want to be really tricky you could use echo implode("<br />", $result[1]); Code (markup):