[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
More.. I'll "can" the expletives... Webseach "php command line arguments" got eg. https://www.php.net/manual/en/reserved.variables.argv.php " $argv (PHP 4, PHP 5, PHP 7, PHP 8) $argv — Array of arguments passed to script Description Contains an array of all the arguments passed to the script when running from the command line. ... " You could have a file with lines of the command and the test command line arguments. eg. test.php 1.2345 -7 test.php "should_not_be_text" -7 etc., etc. Every combination of variables you can think of having significance - +ve/-ve, integer/float, etc. - and all sorts of malicious variables to both run the tests and have a few hundred bytes list of the tests done. > On 18 Jul 2023, at 12:10, Gordon Henderson <gordon+lug@xxxxxxxxxx> wrote: > > On Tue, 18 Jul 2023, rds_met wrote: > >> PHP being "inside out" as intersections in webpages (smart) seems to >> have this problem of making it uniquely difficult to "fire it up" on >> its own. >> >> Am I missing something? > > PHP is a general purpose programming language. It can be run from the command line > like most others - you don't need to run it inside a web server/browser combo. > > Simply start the file with > > <?php > > and end it with > > ?> > > then > > php filename > > and it will run. > > Anything outside those sections will be printed to the output with variables > expanded as usual. > > You can do the usual "shebang" trick > > #!/path/to/php > <?php > printf ("Hello, world!\n) > ?> > This also prints Hello, World! > <?php > printf ("1+2=%d\n", 1+2) > >? > > > > chmod +x filename > ./filename > > and off you go. > > Gordon > -- > The Mailing List for the Devon & Cornwall LUG > FAQ: https://www.dcglug.org.uk/faq/ -- The Mailing List for the Devon & Cornwall LUG FAQ: https://www.dcglug.org.uk/faq/