Results 1 to 4 of 4

Thread: [RESOLVED] Difference between $_Test[_Var1] V.S. $_Test_Var1

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Resolved [RESOLVED] Difference between $_Test[_Var1] V.S. $_Test_Var1

    Hi,
    What is difference between $_Test[_Var1] V.S. $_Test_Var1?

    Ex.:

    $_Test[_Var1]= ...
    $_Test[_Var2]= ...
    $_Test[_Var3]= ...

    V.S.

    $_Test_Var1= ...
    $_Test_Var2= ...
    $_Test_Var3= ...

    Thanks for answer .
    Y.P.Y

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Difference between $_Test[_Var1] V.S. $_Test_Var1

    Apart from their names: $_Test[_Var1] is a variable that is an array with the index _Var1, as _VAR1 is not a string it should be declared prior as a constant. $_Test_Var1 is a variable rather than an array.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Difference between $_Test[_Var1] V.S. $_Test_Var1

    If _Var1 is not declared as a constant and strict mode is off then the interpreter will assume it means the string '_Var1' and generate a notice to this effect. If you have not already I strongly recommend enabling strict mode and using the full error reporting level (at least during development) in order to catch any ambiguous coding such as this.

    Also, I would avoid using names that begin with an underscore since the underscore conventionally indicates a variable that is pre-populated by the interpreter.
    Last edited by penagate; Aug 29th, 2008 at 10:43 PM.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Difference between $_Test[_Var1] V.S. $_Test_Var1

    Thanks both .
    Y.P.Y

Posting Permissions

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



Click Here to Expand Forum to Full Width