I created my first php class. I have two methods in this class. One was to initialize the colors and the other was to return the selected color. But my code encounters this error: “Invalid argument supplied for foreach()”. Please help. class MyColors { private $colors=array(); function __construct( ... , array('id' => 4, 'color' => 'white'), array('id' => 5, 'color' => 'yellow') ); } }
asked
Oct 11, 2020
dorothy
300 points