Constants and Expressions

only for RuBoard - do not distribute or recompile

Constants and Expressions

Certain constants are defined for use in your PHP program. Several of these constants are very useful for debugging your scripts. For a list of pre-defined constants, see the defined constants in the Data Manipulation section in this appendix.

NOTE

In the following functions and discussions, you will see true (or TRUE ), and false (or FALSE ). In PHP true is actually a 1, and false is actually a 0. When a function is described as returning TRUE, it returns the value 1. When it is described as returning FALSE, it is returning the value 0.


You can also define constants yourself. These constants are created using the define() function. The following creates the constant MY_NAME and gives it the value of "George Smith":

 define("MY_NAME","George Smith"); 

PHP differs from C in that constants cannot contain macros. Constants can only contain scalar values. Constants can be used wherever variables or strings or numbers would be used. The following places "George Smith" in the variable $ name :

 $name = MY_NAME; 
only for RuBoard - do not distribute or recompile


MySQL and PHP From Scratch
MySQL & PHP From Scratch
ISBN: 0789724405
EAN: 2147483647
Year: 1999
Pages: 93
Authors: Wade Maxfield

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net