Jump to content

[SOLVED] passing array as argument to a method


play_

Recommended Posts

Say i have an array like this:

 

$example = array("first" => "hello", "second" => "world");

class Display {
   function __construct($example) {
        // here i'd do something so ii would end up with:
        // $this->first = "hello";
        // $this->second = "world";
    }

}

 

Been workin with extract() but can't get to it.

 

 

 

ps: does anyone else keep pressing ctrl + s everytime you post a block of code here, because you're used to doing it all the time in your code editor?  :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.