Welcome Guest, Not a member yet? Register   Sign In
Codeigniter (2.0.3) throws error when calling an object constant
#1

[eluser]cjbuchmann[/eluser]
Hey guys,

not really sure why, but lets say I have a library

Code:
class Client
{
   const TYPE_1 = 0;
   const TYPE_2 = 1;

   public function __construct()
   {...}
}

When I load that library and use it like so :
Code:
$this->load->library('client');
$type = $this->client::TYPE_1;

I get the following error :
Quote:syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM

However if I load the library, throw it in a new variable and then call it like so :
Code:
$this->load->library('client');
$client = $this->client;
$type = $client::TYPE_1;

Everything works fine. I would imagine that both ways should work perfectly fine. Is this really the expected behavior?




Theme © iAndrew 2016 - Forum software by © MyBB