This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PHP Object Creation  RSS feed

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What is the difference between two ways two create objects in PHP.
I think 2 approach is when you don`t have to pass arguments to __construct() method
And 1 approach is when you have to pass arguments to __construct method.

Does __construct() method is by default present in every PHP class ?

 
timo corn
Ranch Hand
Posts: 68
MyEclipse IDE PHP Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find many solutions on the net, eg. http://stackoverflow.com/questions/6830401/php-parentheses-when-creating-new-object

So it is up to you to use brackets in instantiation
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!