Output
Current Error Reporting Level: 22519
Report E_ALL or E_STRICT
New Error Reporting Level: 32767
Notice: Undefined variable: var in
/home3/ashliet/public_html/percolate/exercises/8/8.2.php on line
9
Warning: Invalid argument supplied for foreach() in
/home3/ashliet/public_html/percolate/exercises/8/8.2.php on line
9
Warning: Division by zero in
/home3/ashliet/public_html/percolate/exercises/8/8.2.php on line
10
Report E_WARNING
New Error Reporting Level: 2
Warning: Invalid argument supplied for foreach() in
/home3/ashliet/public_html/percolate/exercises/8/8.2.php on line
20
Warning: Division by zero in
/home3/ashliet/public_html/percolate/exercises/8/8.2.php on line
21
Source<?php echo '<p class="message">Current Error Reporting Level: '.error_reporting().'</p>'; ?>
<div class="error-message">
<h3>Report E_ALL or E_STRICT</h3>
<?php # Script 8.2
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
echo '<p class="message">New Error Reporting Level: '.error_reporting().'</p>';
// Create some errors:
foreach ($var as $v) { } //undefined variables, invalid variable as array
$result = 1/0; //division by zero
?>
</div>
<div class="error-message">
<h3>Report E_WARNING</h3>
<?php
ini_set('display_errors', 1);
error_reporting(E_WARNING);
echo '<p class="message">New Error Reporting Level: '.error_reporting().'</p>';
// Create some errors:
foreach ($var as $v) { } //undefined variables, invalid variable as array
$result = 1/0; //division by zero
?>
</div>