1 | <?php |
||
10 | class KintVariableData |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | public $type; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | public $access; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | public $name; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | public $operator; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | public $size; |
||
36 | |||
37 | /** |
||
38 | * @var kintVariableData[] array of kintVariableData objects or strings; displayed collapsed, each element from |
||
39 | * the array is a separate possible representation of the dumped var |
||
40 | */ |
||
41 | public $extendedValue; |
||
42 | |||
43 | /** |
||
44 | * @var string inline value |
||
45 | */ |
||
46 | public $value; |
||
47 | |||
48 | /** |
||
49 | * @var kintVariableData[] array of alternative representations for same variable, don't use in custom parsers |
||
50 | */ |
||
51 | public $_alternatives; |
||
52 | |||
53 | /** |
||
54 | * @param string $value |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 1 | protected static function _detectEncoding(&$value) |
|
62 | |||
63 | /** |
||
64 | * returns whether the array: |
||
65 | * 1) is numeric and |
||
66 | * 2) in sequence starting from zero |
||
67 | * |
||
68 | * @param array $array |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | 1 | protected static function _isSequential(array &$array) |
|
76 | |||
77 | /** |
||
78 | * @param $string |
||
79 | * @param $start |
||
80 | * @param $end |
||
81 | * @param null $encoding |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | protected static function _substr($string, $start, $end, $encoding = null) |
||
95 | } |
||
96 |
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.