CodeIgniter Forums
How use __set in driver class? - 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: How use __set in driver class? (/showthread.php?tid=75319)



How use __set in driver class? - omid_student - 01-26-2020

Hi
I need to use __set in my driver class (parent)
because i want to add field to my class and i cannot do it
So i have to use method instead of properties
And when i use __set,error :
Message: Undefined property: Sms::$parsgreen


RE: How use __set in driver class? - jreklund - 01-26-2020

__set aren't a function you call by yourself. It's automatically invoked when you set an value to a Class.

$driver = new MyCoolDriver();
$driver->variable = 'My cool value';

$driver->variable will now invoke __set.


RE: How use __set in driver class? - omid_student - 01-26-2020

(01-26-2020, 12:04 PM)jreklund Wrote: __set aren't a function you call by yourself. It's automatically invoked when you set an value to a Class.

$driver = new MyCoolDriver();
$driver->variable = 'My cool value';

$driver->variable will now invoke __set.

Thank you it is solving now