I have passed an array called $items
to my view in order to print it. Take a look:
<?php echo "<br>First print: " . $items;
if ($items != null):
echo "<br>Second print: " . $items;
php endif;?>
The final output is:
First print: Array
As you can see, $items
is not null, however, the second message is never printed. Is there something wrong with my server?
Edit:
I can evaluate $items
with empty function, but I need to evalute it with null comparator
because this variable can be null.
Edit 2:
The $items
can take be take the following values when is passed to the view:
- null:
$items = null;
- array:
$items = array();
or$items = array('a', 'b');