Q. Which of the following is the correct way to create an object in PHP?

  • (A) $obj = new ClassName();
  • (B) $obj = create ClassName();
  • (C) $obj = ClassName();
  • (D) $obj = new object();
πŸ’¬ Discuss
βœ… Correct Answer: (A) $obj = new ClassName();
Explanation: Objects are created in PHP using the 'new' keyword followed by the class name and parentheses.
Explanation by: Rati Dubey
Objects are created in PHP using the 'new' keyword followed by the class name and parentheses.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
66
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
98%
Success Rate