PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
yanglei1979
Forum Commoner
Posts: 38 Joined: Sat Aug 25, 2007 10:21 pm
Post
by yanglei1979 » Tue Dec 04, 2007 7:55 pm
Please Look the code:
Code: Select all
<?php
class Object1 {
function Object1() {
echo"bbbbbbbbbbbbbbbbbbbb";
$args= func_get_args();
call_user_func_array(array(&$this, 'aaa'), $args);
}
function aaa($args) {
echo"eeeeeeeeee";
echo $args;
}
}
$c= new Object1('123');
?>
Can you tell me Why use "&$this"?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Dec 04, 2007 7:58 pm
So PHP uses the object instance instead of a copy of one (in PHP 4.)