什么是PHP函数默认返回? [英] what does a php function return by default?

查看:83
本文介绍了什么是PHP函数默认返回?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  function foo(){} $ b $如果我没有明确地返回任何东西, b  




  1. 是什么类型的?


  2. 它的价值是什么?

  3. li>
  4. 从php4转换为php5吗?


  5. 函数是否有区别foo(){} function foo(){return; }




  6. (我不是问如何像 if(foo()!= 0)...

    解决方案

  7. null

  8. null

  9. if(foo()=== null)

  10. -


您可以通过以下方式尝试:

  $ x = foo(); 
var_dump($ x);


If I return nothing explicitly, what does a php function exactly return?

function foo() {}

  1. What type is it?

  2. What value is it?

  3. How do I test for it exactly with === ?

  4. Did this change from php4 to php5?

  5. Is there a difference between function foo() {} and function foo() { return; }

(I am not asking how to test it like if (foo() !=0) ...)

解决方案

  1. null
  2. null
  3. if(foo() === null)
  4. -
  5. Nope.

You can try it out by doing:

$x = foo();
var_dump($x);

这篇关于什么是PHP函数默认返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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