How can I add key value pairs to an array?
This won\'t work:
public function getCategorieenAsArray(){ $catList = array(); $query = \"SELECT
My PHP is a little rusty, but I believe you're looking for indexed assignment. Simply use:
$catList[$row["datasource_id"]] = $row["title"];
In PHP arrays are actually maps, where the keys can be either integers or strings. Check out PHP: Arrays - Manual for more information.