tonelm54
asked on
Copy array in a class
Ok, as your probably aware Im new to OOP in PHP, so trying to figure things out one at a time.
Im trying to pass an array into a constructor, and copy that array into a variable in the class, so I can use it in another function, so to test:-
Looking at array copying Im doing everything right, but its not working
Im trying to pass an array into a constructor, and copy that array into a variable in the class, so I can use it in another function, so to test:-
class protoMenu{
private $menuArray;
function protoMenu($arrMenu) {
$menuArray = $arrMenu;
$this->drawMenu();
}
private function drawMenu() {
var_dump($menuArray);
}
}
$Menu = new protoMenu(array("divContentsID" => "divMenuContents", "divMenuID" => "divMenu"));
Looking at array copying Im doing everything right, but its not working
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.