Unexpected $end in eval()'d code

前端 未结 2 552
抹茶落季
抹茶落季 2020-12-16 15:31

I hate to ask such a specific question, but I\'m getting an error I can\'t figure out. This is in a cron job which runs on the hour. I\'m creating an array of tasks, each of

相关标签:
2条回答
  • 2020-12-16 16:18

    You are missing ';' on end of string evaluation. Eval function able to process statements or expressions.

    Example:

    $value = 7;
    eval("\$value+=2;");
    echo $value;
    
    0 讨论(0)
  • 2020-12-16 16:31

    eval only accepts statements, not expressions. You need to convert your tests with:

    if (eval("return $task[0];")) {
    
    0 讨论(0)
提交回复
热议问题