Converting a PHP array to class variables
Simple question, how do I convert an associative array to variables in a class? I know there is casting to do an or whatever it is, but that will create a new stdClass and doesn't help me much. Are there any easy one or two line methods to make each pair in my array into a variable for my class? I don't find it very logical to use a foreach loop for this, I'd be better off just converting it to a stdClass and storing that in a variable, wouldn't I?(object) $myarray
$key => $value
$key = $value
class MyClass {
var $myvar; // I want variables like this, so they can be references as $this->myvar
function __construct($myarray) {
// a function to put my array into variables
}
}