04c07-1.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 15 行

PHP
15
字号
<?php// A function that will take any number of arguments, and // return the first one that isn't equal to falsefunction coalesce() {	// Loop through all arguments given	foreach (func_get_args() as $value) {		// If this argument doesn't equal false, return it		if ($value) { return $value; }	}}// Try this on a list of arguments.  Should return 42echo coalesce('', 0, NULL, false, 1-1, 42, 'triccare', '0.0');?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?