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
Loading...
Related Quiz
- What is the goto statement useful for?
- You are writing a PHP script and you need to create a MySQL table. How would you do this?
- How can we check if the value of a given variable is alphanumeric?
- In PHP, you can include a file using the include or require statement, which takes the path to the file as the ______.
- To check the data type of a variable in PHP, which function do you use?