This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes PHP and the fly likes PHP Object Creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "PHP Object Creation" Watch "PHP Object Creation" New topic
Author

PHP Object Creation

Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 222



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 ?


Oracle Java Programmer , Oracle SQL Expert
timo corn
Ranch Hand

Joined: Oct 26, 2013
Posts: 68

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


hth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PHP Object Creation
 
Similar Threads
confused with generics
Singleton Factory Object
Comparator & Comparable
overloading vs overriding
Confusion regarding object creation in Java.