Hi I'd like some help please.
// categories for dropdown
$this->data['dropdown_items'] = $this->category_model->get_key_value('id', 'category_name');
This line of my code returns an array as a key=>value pair array. So if I dump $this->data['dropdown_items'] on screen I get this:
array(8) {
[1] => "cinemas"
[5] => "theaters"
[7] => "night life"
[6] => "restaurants"
[4] => "food"
[2] => "night clubs"
[3] => "opera"
[8] => "misc"
}
i.e [id] => "the category name"
What I'd like to do is to prepend/add as first item of this array a new item so I tried to add it with array_unshift() function:
$this->data['dropdown_items'] = array_unshift($this->data['dropdown_items'], "Please select a category");
This is what I was hopping to get:
array(8) {
[0] => "Please select a category"
[1] => "cinemas"
[5] => "theaters"
[7] => "night life"
[6] => "restaurants"
[4] => "food"
[2] => "night clubs"
[3] => "opera"
[8] => "misc"
}
but instead when I dump the $this->data['dropdown_items'] , I get the following
int(9)
Any ideas what's wrong?