07-02-2009, 10:44 AM
|
#6 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Something quite cool is also the use keyword. I don't know if it's specifically for the anonymous functions, but it's great 'cause then you can pass in variables into functions that you need, but don't want to pass as a param when calling the function.
PHP Code:
$db = new DB();
$connect = function($host, $user, $pass) use($db) {
$db->connect($host, $user, $pass);
}
$connect('localhost', 'root', '');
__________________
|
|
|
|