Instantiate specific class object depending on $variable value without using conditions – PHP
I would want to write the following code without switch, if else or the ternary operator. The code is shown below: switch (type){ case 'bed': function create{ return new Bed($customer, $price, $dimensions ); } break; case 'desk': function create{ return…