Isn't this problem solvable with just a "User Space" function?

<?php

    error_reporting(E_ALL);

    function ifsetor(&$variable, $alternate = NULL){
        if(isset($variable)){
            $tmp = $variable;
            echo('<p>$variable exists.</p>');
        }
        else{
            $tmp = $alternate;
            echo('<p>no $variable here.</p>');
        }
        return $tmp;
    }
    
    // no errors thrown ...

    $nonexistent = ifsetor($nonexistent);
    ifsetor($randomNonexistent);
        
    if($nonexistent !== NULL)
        echo('<p>$nonexistent is NOT NULL</p>');
    else
        echo('<p>$nonexistent is NULL</p>');

?>

Because, as Derick Rethans mentioned, arguments passed by
reference will not trigger the Undefined (variable | index)
Notice at the point of the function call, and also PHP's C++
style default arguments providing the alternate value, surely
the above code would suffice?

Apologies if I've completely misunderstood (with certainty a
non-zero probability)...

Regards,

Cris


        
        
                
___________________________________________________________ALL-NEW Yahoo! Messenger - 
sooooo many all-new ways to express yourself http://uk.messenger.yahoo.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to