Home > Backend Development > PHP Tutorial > 这句php语句是什么意思?

这句php语句是什么意思?

WBOY
Release: 2016-06-23 14:24:24
Original
1107 people have browsed it

$space_name = $tmp_user ? $tmp_user : ($username ? $username : $pd_username);
Copy after login
Copy after login


回复讨论(解决方案)

看下php的三元运算符

$space_name = $tmp_user ? $tmp_user : ($username ? $username : $pd_username);
Copy after login
Copy after login

先执行括号里面的三元字符,然后再执行外面的,很简单,
三元字符就是if语句的简写

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