I guess, you missed some closing div, the reason why, your div's layout is breaking. Please check below code.
<html>
<head>
<title>sdcsdzc</title>
</head>
<body>
function crawl_page($b) {
$a = fopen($b, "r");
$contents = stream_get_contents($a);
fclose($a);
$contents1 = strtolower($contents);
$start = '<div class="example"></div>';
$stop_pos = strpos($first_trim,$stop);
$second_trim = substr($first_trim,0,$stop_pos);
$out['0'] = $second_trim;
return $out;
}
$j = 0;
while ($j <= 2) {
$removed = 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($removed[$j]);
echo "<div style="background-color: #E7EFEF;width:84%;border:1px solid #A5BEBE; margin-bottom: 5px;">";
echo "<div style="background-color: white;border:1px solid #A5BEBE;">";
echo $data[0] . "</div></div>";
$j++;
}
?>
</body>
</html>
Hope this one will solve your problem.