0
我正在開發一個網站,需要在foreach循環中獲取數組的總行數。PHP - 在foreach循環中獲取總行
這裏是我的代碼:
$vr = $_GET['vr'];
$dat = file_get_contents("http://example.com"); //this is a datafeed url.
$exp = explode("\n", $dat);
foreach ($exp as $val) {
if($vr == $val) {
// here I have the code if string is found in array. They were found, but I want to get how many were found.
}
我試過count();
功能,但它顯示111111111111111111
我知道這是可能的,但我不知道如何做到這一點。
謝謝你真的工作。 :) – user2271258 2013-04-11 16:40:44