mysql - PHP change variable to corresponding type -
i'm making website in php different config files depending on company thats using @ moment.
every company has +/- 15 config files same variables ofcourse, different values. every company has able change settings saving settings in mysql database. database has 3 columns 'company_id', 'setting' , 'value'.
when i'm reading config items database, variable type 'string'. ofcourse, if statements "if($setting->value === false)" fails...
is there easy way change type of variable corresponding returned value database?
if want store arbitrary types in single database column, you'll have serialise them string representation, can unserialise value again. php offers serialize
, unserialize
purpose, can use language-neutral format json, xml or yaml.
Comments
Post a Comment