Prepare for the ZCE exam using our quizzes
Check our new DOWNLOADS WEBSITE
This code is no longer valid. Function php_check_syntax() has been removed from PHP since 5.0.5. See: http://www.php.net/manual/en/function.php-check-syntax.php.
Nice article. Live generate documentation, interesting idea. Maybe the Extended Reflection API is something which is useful for this task (http://instantsvc.sourceforge.net/extended-reflection-api.php). It does parsing of docblocks and enhances the reflection API with a type system. It brings annotations to the PHP world, too.
In your article you mentioned the php_check_syntax() function. But in the current online documentation of this function is marked as deprecated. Did you know any other way to include a php-file with out running it's scripts?
It may not be an ideal solution in that it's not natively PHP, but you could perhaps use the command line tool, such as the following:
$filename = '/path/to/script.php';
$cmd = sprintf('/usr/local/bin/php -l %s', escapeshellarg($filename);
$output = trim(`$cmd`);
Note the correct usage of backticks, and that you use the correct path to your CLI version of PHP.
Note: Before your comment appears on PhpRiot, it must be manually approved. The email address field is
optional. If you choose to include it, it will be displayed obfuscated to protect it from spammers.