Vector names

Discussion in 'PHP' started by redhits, Dec 14, 2009.

  1. #1
    Hello , i know that $va-ri-able it's an ilegal name for an variabiel..

    but i noticted that i can declar something like $vector['12-15-09']='text';


    is this 100% ok and compatible?!
     
    redhits, Dec 14, 2009 IP
  2. ShadyStudent

    ShadyStudent Peon

    Messages:
    341
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It looks ok to me and doesn't seem to be a reserved name. See this list for all reserved words of php.

    To be honest, I would just use other variable names for your variables, such as:
    $my_variable = 'this';
    PHP:
    Rather than wasting time with this sort of thing! :)
     
    ShadyStudent, Dec 15, 2009 IP
  3. AlexKey

    AlexKey Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It depends from what you need exactly. You can use "Variable Variables" syntax:
    So, you will have a variable with name "$va-ri-able" and value "value".
    And you can also use another syntax:
    The same result.
     
    AlexKey, Dec 15, 2009 IP