What's this function mean? call_user_func_array()

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

Post Reply
yanglei1979
Forum Commoner
Posts: 38
Joined: Sat Aug 25, 2007 10:21 pm

What's this function mean? call_user_func_array()

Post by yanglei1979 »

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"?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

So PHP uses the object instance instead of a copy of one (in PHP 4.)
Post Reply