SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    May 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question $message_grid.$cnt or $message_grid$cnt - which one is correct

    folks, i need some elementary help. i am new to php,I need to know, which of the below is the correct way
    $message_grid.$cnt or $message_grid$cnt

    to name a variable? i need to store values in variables corresponding to the value of the variable, $cnt;
    example $message_grid1 - corresponding to $cnt=1
    $message_grid2 - corresponding to $cnt=2

    ....and so on. Kindly help

  2. #2
    SitePoint Addict
    Join Date
    May 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guys! why is no one answering this question??????????.....m i not clear?? wld b grateful if someone helps.

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    the first way is the correct way to name a new variable out of two existing one.
    $var = 'var_1';
    $var2 = 'var_2';
    $new_var = $var.$var2;

    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Addict
    Join Date
    May 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks! grateful to u spikez


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
  •