Rate this script:  I Love it  /   I Hate it

Value coalescence in PHP


Code


function coalesce() {
    $args = func_get_args();
    foreach ($args as $arg) {
        if (!empty($arg)) {
            return $arg;
        }
    }
    return $args[0];
}
 

 

 
Value coalescence in PHP scripts | Value coalescence in PHP snippet | Value coalescence in PHP example | Value coalescence in PHP tutorial | Value coalescence in PHP code