Web site traffic - 73Chapter 5Syntax and Variablesmemory use and functionality were
73Chapter 5Syntax and Variablesmemory use and functionality were often agonizing. The PHP designers made what we thinkis a good decision to simplify this by having only two numerical types, corresponding to thelargest of the integral and floating-point types in C. IntegersIntegersare the simplest type they correspond to simple whole numbers, both positive andnegative. Integers can be assigned to variables, or they can be used in expressions, like so: $int_var = 12345; $another_int = -12345 + 12345; // will equal zeroRead formatsIntegers can actually be read in three formats, which correspond to bases: decimal(base 10), octal(base
, and hexadecimal(base 16). Decimal format is the default, octal integers arespecified with a leading 0, and hexadecimals have a leading 0x. Any of the formats can be preceded by a -sign to make the integer negative. For example: $integer_10 = 1000; $integer_8 = -01000; $integer_16 = 0×1000; print( integer_10: $integer_10
); print( integer_8: $integer_8
); print( integer_16: $integer_16
); yields the browser output: integer_10: 1000integer_8: -512integer_16: 4096Note that the read format affects only how the integer is converted as it is read the valuestored in $integer_8does not remember that it was originally written in base 8. Internally, ofcourse, these numbers are represented in binary format; we see them in their base 10 conver- sion in the preceding output because that is the default for printing and incorporating intvariables into strings. RangeHow big (or small) can integers get? Because PHP integers correspond to the C longtype, which in turn depends on the word-size of your machine, this is difficult to answer defini- tively. For most common platforms, however, the largest integer is 231 1 (or 2,147,483,647), and the smallest (most negative) integer is (231 1) (or 2,147,483,647). As far as we know, there is no PHP constant (like MAXINTin C) that will tell you the largestinteger on your implementation. If you really need integers even larger or smaller than thepreceding, PHP does have some arbitrary-precision functions see the BC section of the Mathematics chapter (Chapter 27). DoublesDoublesare floating-point numbers, such as: $first_double = 123.456; $second_double = 0.456$even_double = 2.0;
Note: If you are looking for high quality webhost to host and run your jsp application check Vision florida web design services