I'm working on script that includes others scripts in another folder which they could have a syntax error. I'm reading php arrays in those scripts. What I want to do it's to catch that error when before opening or while opening the script so I can prevent the script from stopping.
For example:
Code: Select all
<?php
$arr = array("one")=>1, "two"=> 2 "three"=>3);
?>
A handler to catch errors would look something like this:
Code: Select all
<?php
set_error_handler('oops');
function oops($type, $msg, $file, $line, $context) {
echo $type.$msg.$file, $line.$context;
}
?>
Code: Select all
<?php
set_error_handler('oops');
$arr = array("one")=>1, "two"=> 2 "three"=>3);
function oops($type, $msg, $file, $line, $context) {
echo $type.$msg.$file, $line.$context;
}
?>
Any ideas? All possible help will be appreciated, Thanks