PHP OOP problem
        Posted  
        
            by Isis
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Isis
        
        
        
        Published on 2010-06-05T14:32:08Z
        Indexed on 
            2010/06/05
            14:42 UTC
        
        
        Read the original article
        Hit count: 203
        
Hello
<?php
class Templater
{
    var $params = array();
    public static function assign($name, $value)
    {
        $this->params[] = array($name => $value);
    }
    public static dunction draw()
    {
        return $this->params;
    }
}
<?php
    $test = Templater::assign('key', 'value')->draw();
    print_r($test);
I need to function "assign" was static, but $params was common for the whole class.. BUt this code is not working((
Fatal error: Using $this when not in object context
Any ideas?
© Stack Overflow or respective owner