Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nvl() function in php file

Tags:

php

mysql

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;
}

What does the nvl() function do??

like image 943
Tray Avatar asked Jul 21 '26 00:07

Tray


1 Answers

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

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;
}

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

like image 156
Tom Haigh Avatar answered Jul 23 '26 15:07

Tom Haigh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!