I have such a code in the Kohana3 framework, that saves values in the Days table.
$column_names=array('morning','day','evening','night');
$values=array('abc','xyz','eeeee','ooooo');
$result=ORM::factory('Day');
$result->morning=$values[0];
$result->day=$values[1];
$result->evening=$values[2];
$result->night=$values[3];
$result->save();
How can I use $column_names to write something like, i.e. using variable as a column name:
$result->$column_names[3]=$values[3];
You can use the parentheses to wrap your array in.
$result->{$column_names[3]} = $values[3];