و عليكم السلام
أخي هذا كود علي السريع
كود PHP:
<?php
$text='
سقوط طائرة والضحايا بالعشرات
http://www.aaaa.com/1234.htm
الدرس الاول في اللغة العربية
http://www.aaaa.com/12345.htm
';
$z_text = str_replace("\n","<br>",$text);
$z_text = str_replace("\r","<br>",$text);
$z_text_explode = explode("<br>\n<br>", $z_text);
echo ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>';
for($i = 0; $i < count($z_text_explode); $i++){
$z_text_explode_1 = "$z_text_explode[$i]<br />";
$z_text_explode_2 = $z_text_explode_1;
$z_text_explode_1 = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">LINK</a>", $z_text_explode_1);
$z_text_explode_1 = ereg_replace(" www\.[^<>[:space:]]+[[:alnum:]/]", "<a href=\"http://\\0\">LINK</a>", $z_text_explode_1);
$z_text_explode_1 = str_replace(array('="http:// www', '> www.'), array('="http://www', '>www.'), $z_text_explode_1);
$z_text_explode_2 = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "", $z_text_explode_2);
$z_text_explode_2 = ereg_replace(" www\.[^<>[:space:]]+[[:alnum:]/]", "", $z_text_explode_2);
$z_text_explode_2 = str_replace("<br>", "", $z_text_explode_2);
$z_text_explode_2 = str_replace("<br />", "", $z_text_explode_2);
$z_text_explode_2 = str_replace("\n", "", $z_text_explode_2);
$z_text_explode_1 = str_replace ("LINK","$z_text_explode_2",$z_text_explode_1);
echo "$z_text_explode_1<br>";
}
?>