Francisc
Francisc

Reputation: 80415

Declare object in PHP

What is the PHP equivalent of ECMAScript's:

var myObject={};

EDIT: I am looking to declare a PHP object.

Thank you.

Upvotes: 0

Views: 158

Answers (1)

mario
mario

Reputation: 145482

That would be:

$myObject = new stdClass;

or:

$myObject = (object)NULL;

See also http://www.php.net/manual/en/language.oop5.basic.php#92123
and http://php.net/manual/en/reserved.classes.php

Upvotes: 6

Related Questions