|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kowach Smarty Rookie
Joined: 26 Jan 2011 Posts: 13
|
Posted: Wed Jun 11, 2014 10:20 am Post subject: silence error operator @ |
|
|
I noticed that @ operator is used in compiled and cached templates in modifier default and smarty const.
It is advised not to use @. There is some performance gain if isset() is used instead @.
This code
Code: |
{$id|default:0}
{$smarty.const.MYCONST}
{$smarty.const.MYCONST|default:0}
|
Results in this
Code: |
<?php echo (($tmp = @$_smarty_tpl->tpl_vars['id']->value===null||$tmp==='' ? 0 : $tmp);?>
<?php echo @constant('MYCONST');?>
<?php echo (($tmp = @@constant('MYCONST'))===null||$tmp==='' ? 0 : $tmp);?>
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|