Skip to content

Instantly share code, notes, and snippets.

@paddycarver
Created January 16, 2012 13:27
Show Gist options
  • Save paddycarver/1620863 to your computer and use it in GitHub Desktop.
Save paddycarver/1620863 to your computer and use it in GitHub Desktop.
Basic php worker for IronWorker.
<?php
$payload = “”;
for($k=0; $k < count($argv); $k++) {
if($argv[$k] == “-payload”) {
$payload = $argv[$k+1];
break;
}
}
$max = 100;
if(!empty($payload) && file_exists($payload)) {
$json = json_decode(file_get_contents($payload));
if($json != null && (!empty($json->max) || $json->max === 0) {
$max = $json->max;
}
}
$values = array();
$num1 = 0;
$num2 = 0;
$newNum = 1;
while($num2 <= $max) {
$num1 = $num2;
$num2 = $newNum;
$newNum = $num1 + $num2;
array_push($values, num2);
}
echo “MAGICALSTDOUTSEPARATOR”.json_encode($values).”MAGICALSTDOUTSEPARATOR”;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment