Skip to main content
fixed grammar
Source Link
bool.dev
  • 17.5k
  • 5
  • 71
  • 93

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I I think ana simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storingstore the instance in a static member variable of class_A when instantiating?

It'll be better if the instance can be stored when calling __construct().Say Say,it it should work without limitation on how it's instantiated.

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

It'll be better if the instance can be stored when calling __construct().Say,it should work without limitation on how it's instantiated.

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always, I think a simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to store the instance in a static member variable of class_A when instantiating?

It'll be better if the instance can be stored when calling __construct(). Say, it should work without limitation on how it's instantiated.

added 142 characters in body
Source Link
user198729
  • 64k
  • 109
  • 256
  • 353

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

It'll be better if the instance can be stored when calling __construct().Say,it should work without limitation on how it's instantiated.

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

It'll be better if the instance can be stored when calling __construct().Say,it should work without limitation on how it's instantiated.

added 122 characters in body; added 19 characters in body
Source Link
user198729
  • 64k
  • 109
  • 256
  • 353

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

EDIT

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

EDIT

As always,I think an simple example is best.

I need to check if there exists an instance of class_A ,and if there does exist, get that instance.

How to do it in PHP?

As always,I think an simple example is best.

Now my problem has become:

$ins = new class_A(); 

How to storing the instance in a static member variable of class_A when instantiating?

added 59 characters in body; added 18 characters in body
Source Link
user198729
  • 64k
  • 109
  • 256
  • 353
Loading
Source Link
user198729
  • 64k
  • 109
  • 256
  • 353
Loading