Hi everybody,
Is it possible to give a property default value without using constructor?

if you are referring to classes, see below:

class className{
  private $property1="hello";
  public $property2="goodbye";
}

Will it definitely work??? If so, thnx)))

It has worked for me in the past. Just make sure you are using a string or a number, and not some variable that you declare outside the class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.