88Part IPHP: The BasicsAs we will see, this (Fedora web server)
88Part IPHP: The BasicsAs we will see, this is equivalent to: if ($first_num > $second_num) $max_num = $first_num; else$max_num = $second_num; but is somewhat more concise. BranchingThe two main structures for branching are if and switch. Ifis a workhorse and is usuallythe first conditional structure anyone learns. Switchis a useful alternative for certain situa- tions where you want multiple possible branches based on a single value and where a seriesof ifstatements would be cumbersome. Comparing Things That Are Not IntegersAlthough comparison operators work with numbers or strings, a couple of gotchas lurk here. First of all, although it is always safe to do less-than or greater-than comparisons on doubles (or even between doubles and integers), it can be dangerous to rely on equality comparisons ondoubles, especially if they are the result of a numerical computation. The problem is that arounding error may make two values that are theoretically equal differ slightly. Second, although comparison operators work for strings as well as numbers, PHP s automatictype conversions can lead to counterintuitive results when the strings are interpretable as numbers. For example, the code: $string_1 = 00008 ; $string_2 = 007 ; $string_3 = 00008-OK ; if ($string_2 < $string_1) print( $string_2 is less than $string_1
); if ($string_3 < $string_2) print( $string_3 is less than $string_2
); if ($string_1 < $string_3) print( $string_1 is less than $string_3
); gives this output (with comments added): 007 is less than 00008 // numerical comparison00008-OK is less than 007 // string comparison00008 is less than 00008-OK // string comp. - contradiction! When it can, PHP will convert string arguments to numbers, and when both sides can be treatedthat way, the comparison ends up being numerical, not alphabetic. The PHP designers view thisas a feature, not a bug. Our view is that if you are comparing strings that have any chance ofbeing interpreted as numbers, you re better off using the strcmp()function (see Chapter 10).
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.