PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?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 ()
{
}
}
?>
The only way to give variables data in an class/object before an instance is available is through the use of static properties. I wouldn't recommend it however. I would say your logic needs rethinking if this is actually needed.