Yes, there is.
The tag <?php
is the default for PHP file openings, unless enabled Short Tag, that lets you open PHP with <?
(which may conflict with XML instructions)
Already the tag <?=
It’s quite simple her purpose:
Note: This directive also affects the abbreviated form <?=
prior to PHP > 5.4.0
, which is the same as <? echo
. For use of this abbreviation is
required short_open_tag to be active. Provided PHP 5.4.0
, <?=
is always available.
Instead of using <?php echo $variable; ?>
just use <?=$variable?>
Code affines become cleaner and readable.
I must point out that this is not from Laravel as described in the question, but from PHP.
Considerations
As he is studying Laravel and has taken over in this matter of passing values to views
recommend to take advantage and study the Blade
In Blade give output of variables only using:
{{ $variable }}
Which is equivalent to:
echo $variable;
A lot simpler, right?
+1 for quoting Lade.
– rray
Blade is one of the next topics of the book I’m following. Vlw by tip.
– Rafael
The
twig
is also top. But it turns PHP into practically another language (roughly speaking)– Wallace Maxters
@juniorb2ss complemented his answer with a small detail, to facilitate the concentration of other questions duplicated by the site.
– Bacco