Re: default/optional parameters in function
| From: | Richard Lynch | Date: | Thu, 04 Jul 2002 21:43:31 +0000 |
| Subject: | Re: default/optional parameters in function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105521@lists.php.net to get a copy of this message | ||
>> Note use of single quotes around the array key names, as well.
>
>Why is this better-- I assume because PHP doesn't have to check for
>variables to interpolate with single quotes?
It's more like this:
<?php
$foo[test] = 5;
echo $foo[test];
?>
When PHP sees this code, what it *REALLY* does (which you'll see if you
start off with error_reporting(E_ALL) is say:
test? what the heck is test? I don't know no stinkin' test. It's not a
variable. It's not a constant. It's not a number. It's not a function.
I dunno what the hell it is. I sure hope you meant 'test', cuz that's what
I have to assume you meant, cuz I got no idea what this test thing is.
$foo = 'test';
is not measurably faster/slower than:
$foo = "test";
--
Like Music? http://l-i-e.com/artists.htm