Static vs. Instantiated Objects in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings all,

Does anyone know how static objects work behind the scenes in PHP5? More specifically, is there a benefit to declaring an object and its methods as static vs the more traditional OO way of instantiating an object and then calling methods through the -> operator?

For example if I have:

class Example {
	public static function doSomething() {
		/* doing something here */
	}
}

and

class Example {

	private __construct() {
		/* constructing here */
	}	

	public function doSomething() {
		/* doing something here */
	}

}

Is it more/less/equally efficient for the engine and parser to do:
$result = Example::doSomething();

or

$example = new Example();
$result = $example->doSomething();

Thanks in advance,
Mark

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux