I want to handle an error in my PHP function without crashing my whole script.
First it pushes this error:
Notice: Trying to get property of non-object in E:\amir\1magazine\tools\xampp\htdocs\CairoHash\assests\plugins\content_handling.php on line 74
I know what the error is for, but I want to continue without crashing my script.
I tried if but it didn't work as I hoped.
$count = count($selector);
$order = substr($order, 0 , -1);
switch ($count)
{
case 1:
$i = $html->find($selector);
break;
case 2:
$i = $html->find($selector[0],$selector[1]);
break;
case 3:
/* ln 74 ->>> */ $i = $html->find($selector[0],$selector[1])->$selector[2];
break;
}
if(isset($i))
{
return $i;
}
This code is supposed to get the $i variable but I need to say if it didn't work then don't crash.