What are the PHP operators “?” and “:” called and what do they do?

前端 未结 10 1753

What are the ? and : operators in PHP?

For example:

(($request_type == \'SSL\') ? HTTPS_SERVER : HTTP_SERVER)
10条回答
  •  情书的邮戳
    2020-11-22 05:10

    This works like an if statement it's very simple and easy once you get used to it. (conditions_expressions) ? what_to_do_if_true : what_to_do_if_false.

提交回复
热议问题