exception - Is there any way to catch eval fatal error in php? -


im executing list of php codes via eval, if there error in code want display code have fatal error/parse error.

is there way give custom message fatal error or other error

my code :

$output = []; foreach($codes $key => $res) {      if(eval($res['code'])) {         eval($res['code']);         $output[$key] = $result;     } else {         $output[$key]  = "fatal error in code";                  }        } var_dump($output); 

try change code to,using try-catch

$output = []; try { foreach($codes $key => $res) {     if(eval($res['code'])) {     eval($res['code']);     $output[$key] = $result; } else {     $output[$key]  = "fatal error in code";              }   }      } catch (exception $ex) { var_dump($ex);  } 

Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -