Last active
December 17, 2015 03:59
-
-
Save uberEllis/5547621 to your computer and use it in GitHub Desktop.
A doodle in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function word_live_as_one($imagination) { | |
global $world; | |
foreach ($imagination as $thought) { | |
switch ($thought) { | |
case 'heaven': | |
case 'hell': | |
case 'countries': | |
case 'possessions': | |
$dreamer = FALSE; | |
break; | |
default: | |
$dreamer = TRUE; | |
} | |
if (in_array($thought, $world->things_to_die_for) || (in_array($thought, $world->things_to_kill_for)) { | |
$dreamer = FALSE; | |
} | |
if (in_array($thought, $world->need_for_greed) || (in_array($thought, $world->need_for_hunger)) { | |
$dreamer = FALSE; | |
} | |
} | |
if ($dreamer == 'FALSE') { | |
echo "I hope some day you'll join us"; | |
} | |
else { | |
$imagination = array( | |
'people living for today', | |
'people living life in peace', | |
'people sharing all the world', | |
); | |
} | |
return $imagination; | |
} | |
?> |
That is SOOOO pretty :)
Some thoughts:
if (isset($immagination)) {
unset($possessions,$greed,$hunger);
}
if (in_array($me,$dreamers)) {
print count($dreamers);
}
if (in_array($you,$dreamers) && brotherhood($man)) {
global $world;
live_as_one($world);
}
I see no reason to unset the variables that are never set. I also think that $imagination is is not unaligned with $greed, $hunger, $possessions.
I think you should they should be unset as a function of the world living as one. So thinking this through:
I would call the top level function image, which you are then passing the things which should be imagined.
Thoughts?
On further reflection, you probably want a recursive function in some functional language. But….
xsyn++
This is very cool though
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist opens up the possibility that imagination can be anything you want it to be. It could be one thing or many things. Heck, it can even be nothing, and you'll still get something back. The only thing you've got to do is show up, and call the function. Even empty hands can create something, and therefore entropy is not inevitable.
The author is obviously quite idealistic, for although he seems to allow for checking if things to die for are in the passed imagination,
$things_to_die_for
is never instantiated with any value. Perhaps this could be a function call, but we'd need to find a way to dynamically generate its user-specific values (perhaps with some investigation of their social media account?), since things to die for are not universal. However, if a philosophical statement agreeing with this generalization were to be made, then instead of using a function we could use a global variable, implying that everyone wants to die and kill for the same things. This is obviously false, and using globals are bad anyway.An argument could be made for the globalization of
$need_for_greed = FALSE;
and$need_for_hunger = FALSE;
In a subversive way, this use of globals would improve the world, albeit to the consternation of good programming practice. The question is then posed: what is better - good programming practice or solving world hunger? An ideal approach would be to find a solution in which these two (good) things are not opposed, perhaps by retrieving the values of the variables from the UN Millennium Development Goals website.