Bu foreach kod ile yanlış bir şey var mı?

0 Cevap php
foreach ($data['tests'] as $testname => $tests) {
echo "<h1>Extraction $testname Tests</h1>\n";
$function = $testfunctions[$testname];

echo "<ul>";
foreach ($tests as $test) {
    echo "<li>" . $test['description'] . ' ... ';
    $extracted = $extractor->$function($test['text']);
    if ($test['expected'] == $extracted) {
        echo " <span style='color: green'>passed.</span></li>";
    } else {
        echo " <span style='color: red'>failed.</span>";
        echo "<pre>Original: " . htmlspecialchars($test['text']) . "\nExpected: " . print_r($test['expected'], true) . "\nActual  : " . print_r($extracted, true) . "</pre>";
    }
    echo "</li>";
}
echo "</ul>";}

Ben hata almaya devam:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\test\runtests.php on line 49

P.S. kod başlangıcı hattı 49, yani probelm foreach statment ile başlar.

0 Cevap