关于 PHP 中的 if 语句 [英] Regarding if statements in PHP

查看:26
本文介绍了关于 PHP 中的 if 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过一些类似的 PHP 语句

I've seen some PHP statements that go something like

 if($variable) {} or
 if(function()) {} (if statements that don't compare two variables)

而且我知道它们的大致意思是函数是否执行或此变量是否存在,但我似乎无法找到有关它们具体如何工作的任何信息.有人可以对此有所了解吗?

and I know they roughly mean if a function executes or if this variable exists but I can't seem to find any information on how they work specifically. Can anybody shed some light on this?

推荐答案

if(function()) {} 表示函数function的返回值是否为真或 true-like 然后块将执行.

if(function()) {} means if the function function's return value is true or true-like then the block will execute.

这篇关于关于 PHP 中的 if 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆