You have a PHP script and you need to create an object from a class. How would you do this?

  • Using the new keyword and the class name
  • Using the create() function and the class name
  • Using the instanceof keyword and the class name
  • Using the object() function and the class name
In PHP, to create an object from a class, you would use the new keyword followed by the class name and parentheses. The correct option is "Using the new keyword and the class name." For more information, consult the PHP documentation on creating objects: http://php.net/manual/en/language.oop5.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *