How to determine if an array is empty in smarty template_PHP tutorial

WBOY
Release: 2016-07-13 10:31:16
Original
1105 people have browsed it

There are two ways to determine whether an array is empty in smarty templates. Below are examples.

(1) Use php count function

{if $array|@count gt 0}
... ...
{/if}
Copy after login

(2) This way of writing is very strange. Today I searched online because the first method didn’t work, and I found the following strange way of writing.

{if count($array) gt 0}
... ...
{/if}
Copy after login

Articles you may be interested in

  • The last record of judging volist loop in thinkphp template
  • How to generate random numbers in smarty template
  • How to use php functions in smarty templates and how to use multiple functions for one variable in smarty templates
  • Insufficient td for circular tables in smarty templates
  • Add the latest tags to information in smarty templates
  • Extension plug-in for for loop in smarty template
  • How to determine whether there are duplicate values ​​in an array in js
  • How to use constants defined by define in the program in smarty template

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764118.htmlTechArticleThere are two ways to determine whether an array is empty in smarty templates. Below are examples. (1) Use the php count function {if $array|@count gt 0}... ...{/if} (2) This writing method is very strange,...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!