What is the different type of variabel in Php?

Discussion in 'Programming' started by applehost, Aug 11, 2012.

  1. #1
    I'm the beginner in this language and want to know about the different type of variable are used in PHP.
     
    applehost, Aug 11, 2012 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    zacharooni, Aug 11, 2012 IP
    applehost likes this.
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    Since PHP isn't typed, a variable is a variable. $variable = 'one' is, of course, a string, but $variable = 1 can be string or integer (or floating point). PHP doesn't care. If the variable can't be used in the construct (raising a string to a power, for instance), you'll get an error, but if it can be done it will be done (even if that's not what you meant - so you have to be careful how you define things).

    See http://www.php.net/manual/en/language.types.type-juggling.php for how PHP changes types as needed.
     
    Rukbat, Aug 11, 2012 IP