Random Echo??????

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

davy2001
Forum Commoner
Posts: 37
Joined: Tue Feb 24, 2004 5:59 pm

Post by davy2001 »

in actual fact, i have!

and umm ohh shut up, lol
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

well what have you tried?? Did it work?? I must have worked perfectly because you haven't tried to ask any questions about it...
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

note to davy:
this is NOT the way to get help

as it clearly states here at least first have a go at writing it yourself and at least post the code so people can tell you whats wrong
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

Wow... You people act as if he's asking for a 2000 line application... Here, took me like half a second to do it. Opening my browser took longer.

Code: Select all

<?php
$random_array = array("blue", "yellow", "green");

shuffle($random_array);

echo $random_array['0'];
?>
It's not like people can only learn from writing it themself. Infact the majority of the things I now know are from looking at other people's examples. Just because you learned the "hard" way doesn't mean he has to.[/b]
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

Drachlen wrote:It's not like people can only learn from writing it themself. Infact the majority of the things I now know are from looking at other people's examples.
Exactly, i will agree 110%. How I learned was i grabbed a bunch of scripts from evilwalrus.com and took the functions I didnt understand to php.net n examined them..

Excellent :wink:

and yeah, the code he was asking for wasnt hard at all. but when someone starts a post out with:
"please will someone please tell me how to make a php do a random echo" that tends to put peoples hearts in the wrong places, lol. :)
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Looking at other people's examples is Perfectly fine. There is nothing wrong with that. But asking for someone to write it for you, is totally different. Atleast look something up, try things on your own, or your never going to get it. Of course we could've written it for him, but he probably doesn't know anything about arrays and has no idea what the shuffle() function does. And he probably wont know, becuase all he did was copy your code, and didn't learn anything...
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

i would of been perfectly happy to write the application / script out for him but he isnt paying so why should i?

if that was the general concensus across these boards none of us would get contracts and i wouldnt have a job

if you want scripts go to evilwalrus / hotscripts, but if you come on here i personally expect not to see in the coding form especially please write this script out for me

isnt the coding forum for help on your own scripts!?
User avatar
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Post by Crashin »

Not to turn this thread into a long-winded discussion about how to best help people and how not to, but when I was first learning I had no idea how to read and interpret the PHP manual. So, when people pointed me there I was overwhelmed by the amount of information. I didn't know where to begin to look for answers.

It was when I took other people's code and broke it down piece-by-piece that I began to get a grasp on how things were done. Particularly arrays...I don't know why, but I had the toughest time getting my head around how to use them properly.

Anyway, no, this forum isn't for getting custom scripts. But, it has provided me with a TON of great guidance and very often some script work that completely cleared things up for me. The benefit back to the forum is that I can now come in here and help people with what I know.

Cheesy, metaphorical circle, I know, I know. Just my two cents...

Okay, I'll shut up now. :oops:
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

as someone pointed out already (i'm to lazy to find the name):

theres a difference between having someone write the code for you to
a.) Just copy n paste it
b.) break it down (as said by me and otheres aboard) to learn with it (like taking the functions to the php manual and doing your homework)

If your a copy n paste, slam bam, your only good for that and when the time comes for you need to imply the method at hand, you'll be back in the same empty dark corner in which you last left off.

If your b, well I hope you understood something from the example and you just added one more "key" to your knowledge bank

farewell
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Ok going off topic from the original post but rather than saying simply look at php.net it would be useful to narrow down the search requirements to "look at php.net and the function shuffle".
Helps the person but enables him/her to learn. After all php.net has a large number of functions if you have no idea of a function name.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

or just link to the function: [php_man]shuffle[/php_man]
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

i think the best way is to write a code exemple explain it with some links..
and ASK him if he understood..

if it's like 3-4 lines.. it's all good ..
but if it's like the hole process of creating deleting updating and selecting data from a mysql DB..
that s kind of different :)
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

yeah i agree, but i would only do that, IF they didn't beg for it, or they had at least tried something logical and looked up a few functions or searched for similar scripts....

But in this case, i could tell he hadn't tried to even look for a script or look for information regarding his question...
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

i know ..yeah i saw his post.. php.net random function.. that wouldn t been really hard to do ..

But well.. i can help ppl that doesn t even want to help themselves :)
but that's just the way i am :)
Post Reply