Converting a query result into an key=>value pairs for a lookup table
Given you are working with PHP, there is no reason to neglect such a feature that already exists in the language.

For example when you query one of the lookup tables for all values, 

$data = $pdo-&gt;query("SELECT * FROM lookup")-&gt;fetchAll(PDO::FETCH_KEY_PAIR);


you get an array like this:

 1 =&gt; 'Trivial',
 2 =&gt; 'Moderate',
 3 =&gt; 'Challenging',
 4 =&gt; 'Formidable'


all thanks to PDO::FETCH_KEY_PAIR fetch mode.

Of course it works only with PDO, but you are supposed to use this driver anyway.