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; | |
} | |
?> |
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
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?