05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Bitwise-OR-equals (|=)<br />

Performs a bitwise OR on the value of the lefthand operand and the righthand<br />

operand, then assigns the result to the lefthand operand.<br />

Concatenate-equals (.=)<br />

Concatenates the righthand operand to the value of the lefthand operand, then<br />

assigns the result to the lefthand operand.<br />

Miscellaneous Operators<br />

The remaining <strong>PHP</strong> operators are for error suppression, executing an external command,<br />

and selecting values:<br />

Error suppression (@)<br />

Some operators or functions can generate error messages. The error suppression<br />

operator, discussed in full in Chapter 13, is used to prevent these messages from<br />

being created.<br />

Execution (`...`)<br />

The backtick operator executes the string contained between the backticks as a<br />

shell command and returns the output. For example:<br />

$listing = `ls –ls /tmp`;<br />

echo $listing;<br />

Conditional (?:)<br />

The conditional operator is, depending on the code you look at, either the most<br />

overused or most underused operator. It is the only ternary (three-operand)<br />

operator and is therefore sometimes just called the ternary operator.<br />

The conditional operator evaluates the expression before the ?. If the expression<br />

is true, the operator returns the value of the expression between the ? and :;<br />

otherwise, the operator returns the value of the expression after the :. For<br />

instance:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!