-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarmup2.php
More file actions
33 lines (28 loc) · 758 Bytes
/
warmup2.php
File metadata and controls
33 lines (28 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/** CLI FILE **/
function x($x)
{
$food = new SimpleXMLElement(file_get_contents($x));
$steps = array();
foreach ($food->instructions->step as $step)
{
$steps[(string) $step['order']] = (string) $step;
}
ksort($steps);
return implode(', ', $steps);
}
switch (true)
{
case (isset($argv[1]) &&
is_file($argv[1])):
echo "Order: ".x($argv[1])."\n\n";
break;
case (isset($argv[1]) && $argv[1] == "-h"):
default:
echo "usage: php warmup2.php [arguments]\n";
echo "\n";
echo "Arguments\n";
echo "-h Show this help screen\n";
echo "<xml file> XML file to be parsed.\n";
echo "\n";
}