Ternary operator in TP3.2

不言
Release: 2023-03-24 15:38:01
Original
3002 people have browsed it

The content of this article is about the ternary operator in TP3.2. It has certain reference value. Now I share it with everyone. Friends in need can refer to it.

Read the manual first ,

templates can support ternary operators, for example:

<br>
Copy after login
  1. ##{<span style="margin:0px;padding:0px;"></span>$status<span style="margin:0px;padding:0px;"></span>?<span style="margin:0px;padding:0px;"></span>'Normal'<span style="margin:0px;padding:0px;"></span>:<span style="margin:0px;padding:0px;"></span>'Error'<span style="margin:0px;padding:0px;"></span>}<span style="margin:0px;padding:0px;"></span>

  2. {<span style="margin:0px;padding:0px;"></span>$info<span style="margin:0px;padding:0px;"></span>[<span style="margin:0px;padding:0px;"></span>'status'<span style="margin:0px;padding:0px;"></span>]?<span style="margin:0px;padding:0px;"></span>$info<span style="margin:0px;padding:0px;"></span>[<span style="margin:0px;padding:0px;"></span>'msg'<span style="margin:0px;padding:0px;"></span>]:<span style="margin:0px;padding:0px;"></span>$info<span style="margin:0px;padding:0px;"></span>[<span style="margin:0px;padding:0px;"></span>'error'<span style="margin:0px;padding:0px;"> </span>]}<span style="margin:0px;padding:0px;"></span>

Note: Dot syntax is not currently supported in the ternary operator.

What does that mean? That is to say, dot syntax is not supported. I took a detour when writing like this before.

For example: {$vo.email}?1:0; It is wrong to write like this. You should change it to {$vo ['email']}?1:0;

<br>

Related recommendations:

PHP Get a certain period of the current day

The above is the detailed content of Ternary operator in TP3.2. For more information, please follow other related articles on the PHP Chinese website!

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