本文介绍了php文件中的nvl()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在浏览一个php文件,并遇到了以下代码:

I'm just looking through a php file and have come across the following code:

switch (nvl($mode))
{
  case "add" :
     print_add_category_form(nvl($id, 0));
     break;

  case "edit" :
     print_edit_category_form($id);
     break;
}

nvl()函数做什么?

What does the nvl() function do??

推荐答案

可能就象Oracle的NVL函数一样,尽管据我所知,它需要两个参数.

Probably it would be like Oracle's NVL function, although as far as I know that expects two parameters.

我使用PHP作为语言搜索了Google Code Search,并且有如下示例:

I searched Google Code Search with PHP as the language and there are several examples such as this:

/**
* If $var is undefined, return $default, otherwise return $var.
*/
function nvl(&$var, $default = "")
{
    return isset($var) ? $var
                       : $default;
}

不过,我认为您最好像ceejayoz所建议的那样在代码中自行查找声明.

I think however you would be better off looking for the declaration in the code yourself as ceejayoz suggests.

这篇关于php文件中的nvl()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 10:06