Properties in PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am new to PHP and still learning and I have a question concerning classes
and properties in PHP Version 5.

if I do the following:

class TSample

$obj = new TSample();
$obj->Name = "Tony";
echo $obj->Name;

Tony is displayed in the browser.  Is this normal behavior?  If so, why?

best regards,

Tony Mays

Re: Properties in PHP

Yes, because objects in PHP are just hash tables. You don't even need
to create the object, in fact. PHP is smart enough to automatically
create an object when you do $obj->Name = "something",

Site Timeline