Re: [PHPLIB-DEV] efficiency of table class From: Alexander Aulbach (ssilk <email protected>)
Date: 03/23/00

On Thu, 23 Mar 2000, Spruce Weber wrote:

}Please respond to my email address, as I'm currently not subscribed to
}phplib-dev.
}
}Correct me if I'm wrong, but aren't PHP function parameters passed by value
}by default? If such is the case, then every member function in the table
}class that takes a DB object or array as a parameter is creating a copy of
}that object and then discarding it as soon as it exits that function's
}scope. With large arrays or db results, the overhead is tremendous.
}
}If a function doesn't modify an object or array passed to it, then it should
}be safe to pass a reference to it rather than a copy of the object...
}
}function verify_db(&$db){}

Hm, of course this should be faster, but think about the function query of
DB_Sql. A call by reference of $db->query("select * from bla") cannot
work.

So if you make such things you have to make sure, that this will never
reduce the usability of a function.

-- 

SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris - (0931)22032

- PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in the body, not the subject, of your message.