Welcome Guest, Not a member yet? Register   Sign In
HELP! regarding variable scope in a library I created
#3

[eluser]danmontgomery[/eluser]
Code:
class Llib {
    var $myArray = array();

    function set_item($item, $value) {
        $this->myArray[$item] = $value;
    }

    function get_item($item) {
        return $this->myArray[$item];
    }
}

// ...

$this->load->library('llib');
$this->llib->set_item('foo','bar');
echo $this->llib->get_item('foo'); // bar


Messages In This Thread
HELP! regarding variable scope in a library I created - by El Forum - 04-25-2011, 07:28 AM
HELP! regarding variable scope in a library I created - by El Forum - 04-25-2011, 07:38 AM
HELP! regarding variable scope in a library I created - by El Forum - 04-25-2011, 10:04 AM
HELP! regarding variable scope in a library I created - by El Forum - 04-25-2011, 07:17 PM
HELP! regarding variable scope in a library I created - by El Forum - 04-25-2011, 08:47 PM
HELP! regarding variable scope in a library I created - by El Forum - 04-26-2011, 04:21 AM
HELP! regarding variable scope in a library I created - by El Forum - 04-26-2011, 06:05 AM
HELP! regarding variable scope in a library I created - by El Forum - 04-26-2011, 07:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB