Is there something wrong with this foreach code?

grosbedos

New Member
\[code\]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>";}\[/code\]I keep getting the error: \[quote\] Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\test\runtests.php on line 49\[/quote\]p.s. the beginning of the code is line 49, so the probelm starts with the foreach statment.
 
Back
Top