This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PHP Object Creation

 
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