Parse error: syntax error, unexpected '::' - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Parse error: syntax error, unexpected '::' (/showthread.php?tid=72840) |
Parse error: syntax error, unexpected '::' - neuron - 02-18-2019 Hello, I defined constants in Otobil_model.php PHP Code: class Otobil_model extends MY_Model Then in Controller I am trying to access these constants: PHP Code: class Otobil extends Public_Controller I am getting " Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in \application\controllers\Otobil.php on line 36" Anybody has idea why I am getting this error? I already did this in my other projects, but now I am getting this error... RE: Parse error: syntax error, unexpected '::' - ciadmin - 02-18-2019 The double colon is for class references (http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php). You should refer to tyour constant as Code: Otobil_model::CORPORATE_TYPE RE: Parse error: syntax error, unexpected '::' - neuron - 02-18-2019 There was error on loading of otobil_model but instead of showing me that error I got "Parse error: syntax error, unexpected '::'" this error. When I fixed model loading error this error is gone. So the result is, there is nothing to prevent us using this way: $this->otobil_model::CONSTANT_NAME As it turns out PHP 5.6 does not support $this->otobil_model::CONSTANT_NAME this type of referencing. I got this error because of I had a 5.6 PHP installed and when I run it on PHP 7.0 it worked; |