Home > Backend Development > PHP Tutorial > Thinkphp template tags if and eq differences and comparison example analysis_PHP tutorial

Thinkphp template tags if and eq differences and comparison example analysis_PHP tutorial

WBOY
Release: 2016-07-13 09:47:31
Original
1108 people have browsed it

Example analysis of the difference and comparison between if and eq in Thinkphp template tags

This article gives an example of the difference and comparison between if and eq in Thinkphp template tags. Share it with everyone for your reference. The specific analysis is as follows:

In TP template language. Both if and eq can be used to compare variables. To summarize the following points:

1. Comparison of two variables:

 ?

 1

 2

 

The former's IF will fail the judgment, but the latter's (or ) will be OK. It should be noted that there is no need to add the $ variable symbol to the name, but the $ variable symbol is required to the value.

2. When the value is NULL:

 ?

 1

 2just a test

 just a test

The former's IF fails to judge, and the latter's (or ) can identify null as ""

3. When the multi-dimensional array and the subscript is 0:

 ?

 1

 2just a test

 just a test

The former cannot be compiled at all using IF, but it can be done by using the following eq

I hope this article will be helpful to everyone’s PHP programming based on ThinkPHP.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1025334.htmlTechArticleThe difference and comparison between Thinkphp template tags if and eq Example analysis This article explains the difference between Thinkphp template tags if and eq and compare. Share it with everyone for your reference. The specific analysis is as follows:...
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