TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   object declaration as class; or class(); (http://www.talkphp.com/absolute-beginners/3936-object-declaration-class-class.html)

planepixel 02-04-2009 05:56 AM

object declaration as class; or class();
 
Hi.i was reading a tutorial on PHP OOP and came across

two object declaration for same class as follows

PHP Code:

$obj1 = new className;
$obj2 = new className();  //i always used this type 

what is the difference between these declarations. tutorial did not explained this. i am new to php and whatever i have coded i always used $obj2 type declaration and never faced problem.

but now i am confused.

Salathe 02-04-2009 10:55 AM

The list of arguments when instantiating an object is entirely optional so instead of providing an empty argument list [new className()] you can provide no argument list [new className].


All times are GMT. The time now is 05:27 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0