これは私に "Notice:Undefined offset:0 in \ index.php in line 12"のようなエラーを表示します。preg_match:未定義オフセット
$arr = array('a', 'b', 'c', 'd');
$i=0;
while($i<=3){
foreach($arr as $value){
//get data
$content = file_get_contents('http://www.example.com/$value');
preg_match("^ y: ....^", $content, $match);
$string = $match[$i];
$i++;
echo $value;
echo $string;
}
}
$arr[1]
として '$のmatch'は、あなたがそれを使用しているように動作しません - それは、サブパターンマッチが含まれています。あなたのコードを修正する前に[PCRE documentation](http://www.php.net/manual/en/book.pcre.php)をよく読んでおくことをお勧めします。 – cmbuckleywhileループは必要ありません –