Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Yeah I meant no php5 on account of some people maybe people unable to test it if they don't have it installed, yes. But who cares. Cheating? Bah! I don't consider that cheating. In fact, I'm surprised the original "hello world" is still there. Why? Because I can put "Jesus" into the input field and it will in essence be do the same thing as before. p.s. - rewriting code to run more efficiently or "better" is okay too. I'm certainly not the most php saavy person here; for instance you guys' OOP skills are much better than mine. So if you feel like "Franky" is somehow being crippled because of his internals, rewriting/reorganizing is okay - to an extent. We don't want complete rewrites every single post, I guess. But, well..well for instance, exactly how redbull turned the simple "hello world" into a method inside a class. LoL, I ran the code and this is what I got:
  2. crap. i meant to say no php5 as well. oh well. i can do that. i guess if someone can't do php5 then tough titties. okay do you guys' posts ^ mean to serve as placeholders or what? nevermind, i will decide for you. unless your thread specificially states "placeholder/whatever" then it doesn't count as a placeholder. okay i just added something quick cuz i have to go soon: <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Actor { public function speak(); public function meet($person); } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } if ($_POST['name']) { $h = new Franky; $h->speak(); $h->meet($_POST['name']); $h->speak(true); } else { echo <<<FORMINT What's your best friend's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'name' size = '10'> <input type = 'submit' value = 'submit'> </form> FORMINT; } ?>
  3. Okay I have been inspired by one of steelman's (though it pains me to admit it ) posts to make a game. P.s. - Don't be jealous of the awesomeness of my game name! Okay here's how it works: It's just like those threads on other message boards where everybody contributes to making a story by posting the next sentence/few sentences/paragraph or whatever, except for we are gonna take the script and the next poster adds his/her little piece to it. The code you add doesn't have to really 'conform' to any particular theme or situation or goal or whatever, but it does have to be somehow useable or relavent to the script as a whole. In other words, if you wish to create a new arm for Frankenstein-Code, that's fine and dandy, but it has to be attached to his body, not just some random arm laying there. Also, the script has to be "self-contained." No database stuff. No flatfile stuff. I don't want people to have to go setting up and altering databases all the time, or having to mess with dir structures/permissions/whatever. Also no cookies. And keep it strictly PHP, as in, no adding in javascript or some other such thing. These rules may or may not be relaxed, depending on how this game progresses and what comes of it. Also, it should go without saying, but I'm gonna say it anyways, so that one cannot argue they "didn't know" : No malicious code, no vulgar or pornographic content, etc.. Now, in order to keep the code consistent and not have like 3 different people posting 'at the same time' or something, here's what we're gonna do: If you wanna be the next person to add to the script, make a 'placeholder' post, saying "placeholder" or "I'm next" or "get off my koolaid yo" or something. Then copy the code from the previous post, add your piece to it, and then edit your placeholder post. p.s. - Please use code tags when posting. Also, even though coding styles differ, things like indenting in some way are standard, so do it. Okay so I guess I'll start with the cheezy but fitting: <?php echo "Hello World!"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.