テキスト ファイルがあり、その中で r とスペースで始まる行だけを読みたいと思っています。strpos を試しましたが、うまくいかないようです。
$r="r ";
$file = file_get_contents('cached-consensus', true);
$n = explode("\n", $file);
foreach($n as $line){
$pos= strpos($line,$r);
echo $pos;}
テキスト ファイルがあり、その中で r とスペースで始まる行だけを読みたいと思っています。strpos を試しましたが、うまくいかないようです。
$r="r ";
$file = file_get_contents('cached-consensus', true);
$n = explode("\n", $file);
foreach($n as $line){
$pos= strpos($line,$r);
echo $pos;}