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

查看:81
本文介绍了关于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或 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天全站免登陆