A

Admin • 802.91K Points
Coach

Q. Which of the following is used to instantiate an object in PHP assuming the class name to be Foo?

  • (A) $obj = new foo ();
  • (B) $obj = new foo;
  • (C) $obj = new $foo;
  • (D) obj = new foo ();
  • Correct Answer - Option(A)
  • Views: 5
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin
class Foo{
//Some code here
}

//Creating object for Foo class
$obj = new Foo();

Note- It is recommended that class name should start with uppercase. For example

class Myclass{
// Code here

}

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.