SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member nickwaughman's Avatar
    Join Date
    May 2001
    Location
    Brighton, England
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A question of foo!

    Can anyone please tell me what foo is for. I have been trying to find out for ages.

    Is foo just used to demonstrate a piece of code?

    Or does it have a specific use.

    Any help would be much appreciated.

    Regards,

    Nick.

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    foo is the first of the metasyntactic variables which is a fancy way of saying that it is a generic placeholder name for a variable. Other examples are foo, bar, foobar, quux (although for some reason I like to use my own "zoot").

    more on the metasyntactic variables
    http://www.tuxedo.org/~esr/jargon/ja...tic%20variable

    more on foo
    http://www.tuxedo.org/~esr/jargon/jargon.html#foo

    Another scheme of metasyntactic variables that you often come accross for examples of strongly typed languages is:

    myInt = 1;
    myString = "foo";
    myCat = new Cat;

    Some people will just use:
    var1, var2, var3, etc...

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    foo is just something most programmers use as general variable names.
    it really has no significance.

    Stuff like $row, $sql, etc.. are used as well.
    a variable name is just that: a name.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for clearing up exactly what freakysid just posted
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know that's what he posted.
    and i reposted it just like that because i thought it'd be easier to understand.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  6. #6
    SitePoint Member nickwaughman's Avatar
    Join Date
    May 2001
    Location
    Brighton, England
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Guys,

    To be honest, foo has been driving me crazy.

    At least I know now my foo's from my foobars.

    Cheers

    Nick.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •