Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem in arrays

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
sandeepshinde
Smarty Rookie


Joined: 07 Jul 2004
Posts: 13

PostPosted: Fri Aug 06, 2004 10:01 am    Post subject: Problem in arrays Reply with quote

I am using arrays in smarty
when i want to show the number of elements in an array

i use {$arr|@count}
i shows me the correct count but when the array is empty it shows me
1 count always.

can anybody tell me y is so?
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 06, 2004 2:12 pm    Post subject: Reply with quote

when the array is empty it shows you 0.
when the array is not an array, but an empty string for example, it shows you 1.

see: http://php.net/count

If var is not an array, 1 will be returned (exception: count(NULL) equals 0).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP