75Chapter 5Syntax and VariablesNotice (Web design careers) that, just as with

75Chapter 5Syntax and VariablesNotice that, just as with octal and hexadecimal integers, the read format is irrelevant oncePHP has finished reading in the numbers the preceding variables retain no memory ofwhether they were originally specified in scientific notation. In printing the values, PHP ismaking its own decisions to print the more extreme values in scientific notation, but this hasnothing to do with the original read format. BooleansBooleans are true-or-false values, which are used in control constructs like the testing portionof an ifstatement. As we will see in Chapter 6, Boolean truth values can be combined usinglogical operators to make more complicated Boolean expressions. Boolean constantsPHP provides a couple of constants especially for use as Booleans: TRUEand FALSE, whichcan be used like so: if (TRUE) print( This will always print
); elseprint( This will never print
); Interpreting other types as BooleansHere are the rules for determine the truth of any value not already of the Boolean type: .If the value is a number, it is false if exactly equal to zero and true otherwise. .If the value is a string, it is false if the string is empty (has zero characters) oris thestring 0 , and is true otherwise. .Values of type NULL are always false. .If the value is a compound type (an array or an object), it is false if it contains no othervalues, and it is true otherwise. For an object, containing a valuemeans having a member variable that has been assigned a value. .Valid resources are true (although some functions that return resources when they aresuccessful will return FALSEwhen unsuccessful). For a more complete account of converting values across types, see Chapter 25. ExamplesEach of the following variables has the truth value embedded in its name when it is used in aBoolean context. $true_num = 3 + 0.14159; $true_str = Tried and true $true_array[49] = An array element ; // see next section$false_array = array(); $false_null = NULL; $false_num = 999 999; $false_str = ; // a string zero characters longCross- Reference07
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision professional web hosting services

Leave a Reply