1 | <?php |
||
5 | class DateTimeWidget extends HelperWidget |
||
6 | { |
||
7 | static protected $defaults = array( |
||
8 | 'FILTER' => 'BETWEEN', |
||
9 | ); |
||
10 | |||
11 | /** |
||
12 | * Генерирует HTML для редактирования поля |
||
13 | * @see AdminEditHelper::showField(); |
||
14 | * @return mixed |
||
15 | */ |
||
16 | protected function getEditHtml() |
||
20 | |||
21 | /** |
||
22 | * Генерирует HTML для поля в списке |
||
23 | * @see AdminListHelper::addRowCell(); |
||
24 | * @param CAdminListRow $row |
||
25 | * @param array $data - данные текущей строки |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function generateRow(&$row, $data) |
||
50 | |||
51 | /** |
||
52 | * Генерирует HTML для поля фильтрации |
||
53 | * @see AdminListHelper::createFilterForm(); |
||
54 | * @return mixed |
||
55 | */ |
||
56 | public function showFilterHtml() |
||
63 | |||
64 | /** |
||
65 | * Сконвертируем дату в формат Mysql |
||
66 | * @return boolean |
||
67 | */ |
||
68 | public function processEditAction() |
||
81 | } |
||
82 |
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.