php, array, function, loops

Oct 28 2014 2:00 AM
I am getting problem in how to create discrete divs when accessing the function's returned value into a while loop, but I want that divs to be created one outside the other instead of being created one inside the other. See the below code:
 
 
<html> <head> <title>sdcsdzc</title> </head> <body> <?php  $j=0; while($j<=2) {                    $url=array("http://www.w3schools.com/html/default.asp","http://www.w3schools.com/js/default.asp","http://www.w3schools.com/sql/default.asp"); $data=crawl_page($url[$j]); echo " <div style=' background-color: #E7EFEF;width:84%;border:1px solid #A5BEBE;'> <div style='background-color: white;border:1px solid #A5BEBE;'> $data[0] </div> </div>"; $j++; }  function crawl_page($b) {  $a=fopen($b,"r"); $contents=stream_get_contents($a); fclose($a); $contents=strtolower($contents);  $start='<div class="example"';  $start_pos=strpos($contents,$start); $first_trim=substr($contents,$start_pos);  $stop='</div>'; $stop_pos=strpos($first_trim,$stop);  $second_trim=substr($first_trim,0,$stop_pos);  $out['0'] = $second_trim; return $out; } ?> </body> </html>
 I cant send you the image of my output but you can run this code directly in php and see the divs are creating inside the other, but I want them to come out discretely one after the other. If anyone can do this please do tell me, its important for me !!