Home  >  Article  >  Backend Development  >  How to determine if an array is empty in smarty template_PHP tutorial

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

WBOY
WBOYOriginal
2016-07-13 10:31:161104browse

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}

(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}

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,...
Statement:
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