RE: [PHP-WIN] php defining variable defaults?
| From: | FARRINGTON, RYAN | Date: | Thu, 13 Feb 2003 22:28:50 +0000 |
| Subject: | RE: [PHP-WIN] php defining variable defaults? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18534@lists.php.net to get a copy of this message | ||
that is exactly what I was looking for!!! =) Thank you very much!
-----Original Message-----
From: Matt Hillebrand [mailto:matt@medmarket.com]
Sent: Thursday, February 13, 2003 4:21 PM
To: php-windows@lists.php.net
Subject: RE: [PHP-WIN] php defining variable defaults?
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:ryan.farrington@cingular.com]
|Sent: Thursday, February 13, 2003 4:12 PM
|To: 'php-windows@lists.php.net'
|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