<?
$str="The bird flys in through the windows.
//The cat jumps up onto the bed.
The dog is black.";
/*ผมอยากจะให้เหลือแค่
"The bird flys in through the windows.
The dog is black."
*/
$pos= strpos($str,'//');
$sub=substr($str,$pos,-17);
$result=str_replace($sub,'',$str);
echo $result;
?>
<?php
$s = "The bird flys in through the windows.\r\n//The cat jumps up onto the bed.\r\n//The rat jumps up onto the table.\r\nThe dog is black.//The rat jumps up onto the table.\r\n";
echo '<br>bfore:<pre>',$s,'</pre>';
$s = preg_replace('/^(\/\/[^\r\n]*\r\n)/m','',$s);
echo '<br>after:<pre>',$s,'</pre>';
?>