anyone has an idea how to create a class in PHP then when called loads an array for example
$cart = new Cart(); //where Cart is the Class Name
print_R($cart); //print the constructor
At this Point I want something like this array
$cart = ([id] => ,[currency]=> ,[country]=> )
How anyone guide me how can I set up a constructor for this call,even if the properties are empty , I just want the key values for the array so that I can set its values like below
$cart->id = 1;
$cart->currency = EUR;
$cart->country= DE;
in this way it would be much easier to call in a new CART in this example… and then manipulate the class properties in order to save to database etc
If you pass no arguments to your constructor, it’ll inherit the defaults in the function argument spec.