Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

overloading PHP

Hello,
I had a question concerning overloading in PHP, which is not possible.
Is there an elegant way to do this? I read s.th. about using the factory pattern with a private constructor.

The background is this, I have a User class and I want to differentiate between the current user, with no constructor-parameter (I fetch the id from the session) and with an other user, with one parameter: __construct($id)?

Thanks, iago

from PHP https://ift.tt/3jIy0OT
via IFTTT

Post a Comment

0 Comments