Jump to content

eval() Problem


nomaam

Recommended Posts

Hello:

 

I am new to PHP and am trying to learn what I can. I am stuck on a problem where I am working with a try block to catch if a required file is not found here is the code so far:

 


try {
  if (!@eval(require("header.inc.php"))) {
    throw new exception('File not found');
    }else{

   print "File found.\n";

}
  
} catch (Exception $e) {
  echo 'Caught exception: '.$e->getMessage()."\n";
}


 

The problem seem to be the syntax for the eval() function. I have tried many many different variations on the syntax including changing all the quotes to different types and removing them and even placing the string in a variable then trying to evaluate it. Nothing seems to work.

 

Any help would be appreciated.

 

Thanks.

 

 

Link to comment
https://forums.phpfreaks.com/topic/67190-eval-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.