Movies as Code
Movies as Code is a website translating movies into seemingly useless lines of codes.
Geeky? Funny? or poetics? Tell me what you think. Below is based on the movie Inception.
<?php
class Dream
{
const DREAM_LEVEL = 1;
public function goToSleep() {
try {
$this->goDeeper( self::DREAM_LEVEL );
} catch (MyException $e) {
throw new Exception(“You’re actually in the middle of the workshop right now, sleeping”);
}
}
protected function goDeeper($dreamLevel) {
try{
$dreamLevel+=1;
$this->goDeeper($dreamLevel);
} catch (MyException $e) {
throw new Exception(‘Your world is not real!’);
}
}
}
$alfredo = new Dream;
try{
$alfredo->goToSleep();
} catch (Inception $kick) {
echo ’Think about it ‘.$kick->getName().’, how did you get here?’;
}
?>
Filed under: code — kianpeng.ong @ 1:19 pm April 7, 2012
Comments (1)