Apr/095
God’s Design for our lives, as a PHP Script
UPDATED: Thanks to AKX for a few corrections (he’s the PHP wiz, not me)
Here’s the gospel for programmers.
Sorry about the spacing… wordpress doesn’t like tabs. Please feel free to point out any syntax errors.
var $sin = 0;
var $pricePaid = true;
var $heaven = true;
var $alive = true;
var $deathAge = 120;// please set this variable as a boolean
var $acceptChrist =function eatForbiddenFruit ($temptation, $resistance) {
if ($temptation == true && $resistance = false) {
$sin = 1;
$pricePaid = false;
}
}function jesus($sinOfChrist) {
death($sinOfChrist,true);
}function death($amountOfSinFromLife, $programmer) {
if ($amountOfSinFromLife == 0 && $programmer == true) {
$pricePaid = true;
}
else {if ($acceptChrist && $pricePaid) {
$amountOfSinFromLife = $sinOfChrist;
}if (amountOfSinFromLife == 0) {
$heaven = true;
}
else {
$heaven = false;
}
}}
eatForbiddenFruit(true,false);
jesus(0);
while ($alive) {
$sin ++;
if (rand(0,$deathAge) == $deathAge) {
$alive = false;
break;
}$deathAge –;
}death($sin,false);
I’m thinking about expanding on this, to include all the major events of the bible. What do you think?
April 25th, 2009
This great honey. What an excellent way of explaining Jesus!
April 25th, 2009
You can’t redefine die(), since it’s a language intrinsic.
Also, integer values should not be defined or compared as strings.
“sin++” probably needs to be “$sin++”, because otherwise “sin” would be either a constant (and you can’t modify constants), interpreted as the string “sin”, or the trigonometric function sin().
while($alive == true) could be simplified as while($alive) (as can all the , and to avoid one extra $deathAge–; you could add break; after $alive=false;.
Also, it’s not really good practice to have user-definable variables so deep inside the code ($acceptChrist).
Oh, and the global variables aren’t, due to PHP’s retar… unconventional scoping, visible within the functions, unless you define them with global $…; within the function body.
… And the if clause lacks parentheses in eatForbiddenFruit.
April 25th, 2009
I love it!
April 26th, 2009
/* Import theBalance() */
include(’personalDoctrine.php’);
/* Load values of system variables */
public $humanity, $kindness, $gentleness;
public $inhumanity, $hate, $greed;
$alive = true;
$man = $humanity + $kindness + $gentleness;
$machine = $inhumanity + $hate + $greed;
while($alive) {
theBalance($man,$machine);
} else {
end;
}
April 26th, 2009
Already spotted an error… can you spot it? meh!