Ok, I ran into a little pickle. I need to check some PHP errors for syntax errors. I noticed this bit that needs to be run from the command line:
php -l somefile.php
However, is there a way to run this from the PHP file itself? I looked and think that I can somehow use the parse_str function to do this by entering it in $ _GET, but I canβt understand how this works.
Someone else told me to use the token_get_all() php function to determine this.
But I canβt figure out how to do this with any approach? Can anyone here give me some sample code to get started, perhaps? I don't think using eval() is the way to go, although I worked with eval($code) , but I don't think I should run the script if there are PHP syntax errors.
Any help on this is greatly appreciated, as always!
php syntax-error token
Solomon closson
source share