When calling eval in Ruby you can specify a filename to display in errors to make it easier to see which block of code passed to eval caused a problem. In PHP eval only seems to take one argument. Is there a way to do this in PHP?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
evaldoes not support such a parameter you know from ruby.However, you can install a PHP extension called
xdebugwhich displays a stacktrace in case of an error/warning – so for theevalpart as well.In any case you should take care when dealing with eval and think about what you can do to not make use of it.