Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: min(five, seven)?
(Example: nine)

The Note You're Voting On

Damien B.
17 years ago
This is how I handle arguments with getopt: I use switch within a foreach at the beginning of a program.

<?php

$opts
= getopt('hs:');

// Handle command line arguments
foreach (array_keys($opts) as $opt) switch ($opt) {
case
's':
// Do something with s parameter
$something = $opts['s'];
break;

case
'h':
print_help_message();
exit(
1);
}

print
"$something\n";

?>

<< Back to user notes page

To Top