Solved

Copy array in a class

Posted on 2013-01-17
1
250 Views
Last Modified: 2013-01-17
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:-

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"));

Open in new window


Looking at array copying Im doing everything right, but its not working
0
Comment
Question by:tonelm54
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 38789442
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question