thinkphp template label if and EQ difference and comparison case Analysis _php instance

Source: Internet
Author: User

This article illustrates the difference and comparison between the thinkphp template label if and EQ. Share to everyone for your reference. The specific analysis is as follows:

In the TP template language. Both if and EQ can be used for comparison of variables. Summarize the following points:

1. Comparison of two variables:

<if condition= "$item. group_id eq $one. group_id" > <eq name= "item.group_id" value= "
$one. group_id" >

If the former is a failure to judge, the <neq> (or <eq>) of the latter is OK. Note: Name there is no need to add the $ variable symbol, and value there to add the $ variable symbol.

2. When the value is empty (NULL):

<if condition= "name Neq ' NULL '" >just a test</if> <neq name=
"name" velue= "" >just a Test</neq >

If the former is a failure to judge, the <neq> (or <eq>) of the latter can identify null as ""

3. Multidimensional array with subscript 0:

<if condition= "name.0 neq ' Test" >just a test</if>
<eq name= "name.0″velue=" test ">just a test< /eq>

The former can not be compiled by using if, and the EQ on the back will

I hope this article will help you with the PHP program design based on thinkphp.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.