chinmay.sahoo
New member
Semantic errors occur when you write code that obeys the rules of PHP’s syntax, but which, when executed, breaks the “runtime rules” of PHP. For example, the foreach statement expects you to give it an array
Because $variable was not an array, this script produces the following error message:
<?php
$variable = 'This is not an array';
foreach ($variable as $key => $value) {
echo $key . ' : ' . $value;
}
?>
Because $variable was not an array, this script produces the following error message: