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
2. When the value is NULL:
?
1
2
The former's IF fails to judge, and the latter's
3. When the multi-dimensional array and the subscript is 0:
?
1
2
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.