Code: Select all
<?php
class test {
public $some_var;
}
$data['some_var'] = 'test';
print_r(new test($data));
// I need this way to set $some_var to 'test'
?>Moderator: General Moderators
Code: Select all
<?php
class test {
public $some_var;
}
$data['some_var'] = 'test';
print_r(new test($data));
// I need this way to set $some_var to 'test'
?>Code: Select all
<?php
class test {
public $some_var;
}
$data = new test($data);
$data->some_var = 'test';
print_r($data);
// I need this way to set $some_var to 'test'
?>Code: Select all
class test {
public $some_var;
public function __construct($array) {
if (isset($array["some_var"])) $this->some_var = $array["some_var"];
}
}
$data = array("some_var" => "test");
print_r(new test($data));Well then, define what you consider to be a custom handler. You're going to have to write code: what type and style is up to you.guygk wrote:So basically that is what I meant by "custom handler".