Hi All,

If I was to code something like:

<?php

  class Example {
    var $abc = false;
    function Demo($param) {
      // etc //
      return $param;
    }
  }

  $ex1 = new Example;
  $ex2 = new Example;

?>

There are now 2 variables, both with a copy of the object Example in them.
Now, I would expect the variables in the objects to be duplicated (eg: the
memory space for $ex1->abc to be separate from $ex2->abc). However, is the
method definition the same?

Is the method definition and contents duplicated each instancing? (eg: if
I have 100,000 instances of an object with a "print()" method - would that
method be copied to each object - or would the reference the same memory
space).

If the method is shared, then would a static variable in a method be
shared across the entire class - or would it still reference to that
object instance's variable memory space?

If the method is not shared, could this cause an issue with a class that
has a lot of methods being instanced lots of time and taking up lots of
memory?

If anyone can let me know how this conceptually works, and (if possible) why.

Thanks,


-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to