3pod PHP Learning |
PHP supports the following types: • integer • floating-point numbers • string • array • object The type of a variable is usually not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which that variable is used. If you would like to force a variable to be converted to a certain type, you may either cast the variable or use the settype function on it. Note that a variable may behave in different manners in certain situations, depending on what type it is a the time. For more information, see the section on Type Juggling. Integers Integers can be specified using any of the following syntaxes: $a = 1234; # decimal number $a = -123; # a negative number $a = 0123; # octal number (equivalent to 83 decimal) $a = 0x12; # hexadecimal number (equivalent to 18 decimal) Floating point numbers Floating point numbers ("doubles") can be specified using any of the following syntaxes: $a = 1.234; $a = 1.2e3; Strings Strings can be specified using one of two sets of delimiters. 80 |
Next >> |
Tripod >> 3pod Tips & Learning and manuals for educations