|
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 |
scdgro Smarty Regular
Joined: 24 May 2003 Posts: 39 Location: Netherlands
|
Posted: Sat Mar 19, 2011 9:08 am Post subject: foreach outputs with boolean false, intented or not |
|
|
Using latest svn release @ smarty 3 :
I wonder why the foreach loop outputs data when the data passed
to it is boolean false.
When the data is null, then the foreach outputs nothing.
The loop below is executed once if $data == false
and never when $data == null
Code: | {foreach $data as $d}
//some code
{/foreach} |
I assumed that null and boolean false both don't give any output. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 19, 2011 6:17 pm Post subject: |
|
|
This is intended behaviour. Only $data=null will not iterate. |
|
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
|