How to check PHP filecode syntax in PHP?

Posted by Tower on Stack Overflow See other posts from Stack Overflow or by Tower
Published on 2010-04-20T12:34:35Z Indexed on 2010/04/20 12:53 UTC
Read the original article Hit count: 261

Filed under:
|
|
|

Hi,

I am in a need of running the PHP parser for PHP code inside PHP. I am on Windows, and I have tried

system("C:\\Program Files (x86)\\PHP\\php.exe -l \"C:/Program Files (x86)/Apache/htdocs/a.php\"", $output);
var_dump($output);

without luck. The parameter -l should check for correct PHP syntax, and throw errors if some problems exist. Basically, I want to do something similar to this picture:

alt text

That is, to be able to detect errors in code.

© Stack Overflow or respective owner

Related posts about php

Related posts about syntax