Jump to content

help prepending values to keys in associative array


plastik77

Recommended Posts

hi, i'm trying to find a way to prepend values (uri data) to keys in an associative array which i've created from values in my database. this should be straightforward i'm sure but i can't find the right process to do this!

 

i'm generating a dropdown list populated with values from my database, and all i want to do is to be able to modify the keys in the array as I need to make them part of a url e.g [senior/art/54] => [First and Second Year Art] - any ideas on the best way to do this array manipulation?

 

so i use this neat ORM function to create an associative array -

PHP Code:

$page_children = $page_children->select_list('id', 'name');

this creates an array as follows:

Array (

[54] => First and Second Year Art

[55] => Standard Grade Art

[56] => Higher/Intermediate 2 Art

[57] => Advanced Higher Art )

 

Any help appreciated!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.