note 39408 deleted from function.isset by nlopess

From: Date: Tue, 27 Jan 2004 18:02:23 +0000
Subject: note 39408 deleted from function.isset by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-64272@lists.php.net to get a copy of this message
Note Submitter: Charlie Hayes ---- I was looking for a way to do this in a function: if(!isset($foo)){ $foo="blah"; } and came up with this function SetIfNotSet($Variable,$Default){ global ${$Variable}; if (!isset(${$Variable})) { ${$Variable}=$Default; } } SetIfNotSet("foo","blah"); Im not sure how flexable it is, but it should work.

« previous php.notes (#64272) next »