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

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

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

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) {

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

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

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests