Avatar of Glen Gibb
Glen Gibb
Flag for Canada asked on

Create a php object

Experts,

I'd like a class object that populates itself when I supply a parameter.  

EG pseudocode:

---
class User

agent = new User(1001)
---

How do I make the object constructor so that if the parameter is supplied the object populates with the requested values or if not, just creates a new object?

Capt
PHP

Avatar of undefined
Last Comment
Glen Gibb

8/22/2022 - Mon
SOLUTION
Beverley Portlock

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

No points for this, please, but the required reading begins here:
http://php.net/manual/en/language.oop5.php
ASKER CERTIFIED SOLUTION
Derokorian

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Glen Gibb

ASKER
Thank you, all experts.  Just what I needed.

Ray, thanks for the reference.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck