Solved

Copy array in a class

Posted on 2013-01-17
1
240 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
1 Comment
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 500 total points
ID: 38789442
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now