Object Types

December 1st, 2009

There is one function and one binary operator for determining if a variable is an object. Is_object is_object($aVar) – Determines if $aVar is an object. When $aVar is instantiated (created) from a class, this function returns true. Otherwise it returns false. We need an object to work with. This primitive caveman will suffice. File: Caveman.php [...]

Primitive Type Functions

November 29th, 2009

The following are a list of primitive type functions that tests if a variable if of a given primitive type (boolean, integer, float, string, etc.). If the variable is of the type being tested a boolean of true is returned from the function, otherwise a false is returned. Remember, that variables can be of different [...]

Logical NOT

November 27th, 2009

A logical NOT inverts its input value. Speaking in terms of logical gates (refer to the previous posting), its truth table is: A NOT A false true true false In PHP, this is a unary logic operator, denoted by !, that prefixes its input value. <?php $fileName = "test.txt"; $fileHandle = @fopen($fileName, "rt"); if (!$fileHandle) [...]

Logical AND, OR and XOR

November 27th, 2009

A condition tested in an if-statement can be composed of one or more conditions. This as known as a complex boolean expression where the expression evaluates to a boolean value of true or false. Keeping things simple, I will use two conditions (or two boolean expressions) in these examples. Although I feel tempted to go [...]