__set before __construct
Posted: Mon Feb 19, 2007 6:34 am
hey, my problem is im trying to use __set before i run __construct, any way to do that??
the code:
cheers
the code:
Code: Select all
<?php
require_once('html_printer.php');
$data = array('1', '2', '3');
$printer = new html_printer();
$printer->data = $data;
?>Code: Select all
<?php
class html_printer
{
private $data = array();
public function __set($variable, $value)
{
$this->$variable = $value;
}
public function __construct()
{
//make head and css
$this->header();
//printout the entire crap for the report
$this->body();
//printout closing tags
$this->footer();
}
private function header ()
{
$this->css();
print_r($this);
}
private function body ()
{
}
private function footer ()
{
}
private function css ()
{
}
}
?>cheers