Difference between revisions of "Php"

From Wiki2
Line 1: Line 1:
==bits of code I always forget==
==bits of code I always forget==
===reading command line arguments===
===reading command line arguments===
<
<syntaxhighlight>
<?php
echo count($argv);
if (count($argv)<2){ //if no command line argument
echo("script requires command line argument with name of db to backup");
exit();
}
$db = $argv[1];
?>
</syntaxhighlight>


===PHP questions===
===PHP questions===

Revision as of 11:48, 13 December 2012

bits of code I always forget

reading command line arguments

<syntaxhighlight> <?php echo count($argv); if (count($argv)<2){ //if no command line argument echo("script requires command line argument with name of db to backup"); exit(); } $db = $argv[1]; ?> </syntaxhighlight>

PHP questions