Merge remote-tracking (subtree) branch 'PracticingPhp/master'

This commit is contained in:
Dan Buch
2012-03-03 20:18:34 -05:00
905 changed files with 218528 additions and 0 deletions

9
PracticingPhp/cli/args Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/php -q
<?php
printf("ARGC = $argc\n\n");
foreach($argv as $i => $value) {
printf("ARGV[$i] = $value\n");
}
?>

24
PracticingPhp/cli/daemonized Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/php -q
<?php
set_time_limit(0); // Remove time limit
if (pcntl_fork()) { // Fork process
printf("Daemon running.\n");
} else {
$sid = posix_setsid(); // Make child process session leader
if ($sid < 0) {
exit();
}
while (true) {
$outfile = fopen('daemon.log', 'a+');
fwrite($outfile, time() . " Hello World via command line daemon!\n");
fclose($outfile);
sleep(1);
}
}
?>

6
PracticingPhp/cli/hello Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/php -q
<?php
printf("Hello World via command line!\n");
?>