Is it ok to send an unset variable to a function?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Tony121076
New php-forum User
New php-forum User
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm

Is it ok to send an unset variable to a function?

Postby Tony121076 » Tue Apr 01, 2003 5:58 am

I know this is easy to test, but I can't test anything right now (long story, please humor me).

Will I get an error if I pass, say 3 variables to a function, if one of those variables is unset?

NOTE: The function doesn't ever refer to the unset variable, except when it's called, ie...

function myfunc ($setvar1, $setvar2, $unsetvar) {
...

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Postby *JaH* » Tue Apr 01, 2003 6:41 am

yes you will. You'll get the Undefined Variable error, but your script will go on :) if you put an @ before it, it will ignore the error


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest