返回值_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 12:39:44890browse

使用一些可选的返回语句,任何类型的数值都能被返回,包括对象和广义表.

function my_sqrt ($num)

{

return $num * $num;

}

echo my_sqrt (4); // 输出 '16'.

 

可以返回多值,但是同时的影响使通过一个广义表来实现:

function foo()

{

return array (0, 1, 2);

}

list ($zero, $one, $two) = foo();

Statement:
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
Previous article:语句的脱离方法_PHPNext article:比较操作符_PHP