> > I'll guess that you're trying to access $frequency outside of the
> > function, after you've called it, right? If so, read up on variable
> > scope in the manual.
>
> No, I'm trying to access it inside the function. This is what I have (or
an
> example, since I don't have it right in front of me right now):
>
> function func($a = 1, $b = 2) {
> print("[$a]");
> }
>
> >From the above example, I get [] as output.

Well, my guess was wrong. I guess it has to happen eventually. :)

So how are you calling the function? If you have:

function func($a=1,$b=2)
{ print("[$a]"); }
func();

all by itself, does it work? No reason it shouldn't. Maybe you think you're
passing a value to func(), but you're really not. In order to get what you
say, you _have_ to be passing an empty string as the first parameter.

Wait... you realize that if you call

func('');

That $a in the function will be an empty string, right? $b would get the
default value of 2. They would only get that default value if you do not
include that parameter in the function call at all.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to