Jump to content

Were default property values always allowed?


LLLLLLL

Recommended Posts

class foo {
  // was this always allowed?
  public $bar = 'abc default value';

  // or did older versions only allow this?
  public $bar;
}

I couldn't determine the answer to this question looking at documentation. I found some old code where no class had a default value. Maybe it was a developer preference, but I was wondering if older PHP versions didn't even allow default values?

 

Just a question of curiosity. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.