First off, I'm confused on how to run PHP in the command-line. I've been reading several articles on the web and they all say that you need a CLI (Command Line Interface).
Basically, I have PHP files, and I want to call something like this:
php -l somefile.php
But I'm wanting to check a string, not a file! How can this be done? Can using STDIN, STDOUT, or STDERR help with this at all?
If so, how? Can someone provide an example here?
Also, where do I place that above code? I don't have access to a command-line (I don't think), or do I just place it within a PHP file itself that will run? Will it execute this code, in that case, within the command-line?
I'm completely clueless on how this PHP command-line thing works... Can someone please help shed some light on this exactly?
If you want lint code (not within a file) the only option is to write a wrapper.
Assuming your $HOME/bin precedes /usr/bin, you could install your wrapper in $HOME/bin/php that has a different option for command-line linting. The wrapper would create a temporary file, put the code in there, run /usr/bin/php -l file
and then delete the temporary file.
HTH.