You could do
if(!isset($var)) $var = 'asdf';
Or if you're using a function, you can specify default values in the
parameter list:
function my_func($var1 = 'default1', $var2 = 'default2') {
// do stuff
// do stuff
}
Matt
|-----Original Message-----
|From: FARRINGTON, RYAN [mailto:[EMAIL PROTECTED]]
|Sent: Thursday, February 13, 2003 4:12 PM
|To: '[EMAIL PROTECTED]'
|Subject: [PHP-WIN] php defining variable defaults?
|
|
|ok cold fusion has the ability to do a <cfparam name='' default=''>
|
|this lets you specify a variable name to be defaulted to a
|value if it is called without being defined. I usually use
|this for variables specified by forms either by GET or POST.
|now I can't find it's equivalent in PHP.. can anyone direct me
|in the correct direction?
|
|
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php