1 | <?php |
||
7 | class SimpleXMLElement extends XMLElement |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @param string $name |
||
12 | * @param string $value |
||
13 | * @param string $namespace |
||
14 | * @return XMLElement |
||
15 | */ |
||
16 | public function addChild($name, $value = null, $namespace = null) |
||
24 | |||
25 | /** |
||
26 | * Create a child with CDATA value |
||
27 | * @param string $name The name of the child element to add. |
||
28 | * @param string $cdata_text The CDATA value of the child element. |
||
29 | */ |
||
30 | public function addChildCData($name, $cdata_text) |
||
35 | |||
36 | /** |
||
37 | * Add CDATA text in a node |
||
38 | * @param string $cdata_text The CDATA value to add |
||
39 | */ |
||
40 | private function addCData($cdata_text) |
||
46 | } |
||
47 |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.