OK this is probably silly and old hat for a lot of you, but I started doing something new today and I like it both for clarity and speed.
If I have a dynamic SELECT in a form, I've used two different methods to populate it: either I ajaxed an answer or had my PHP create JS code that was on page ... something like this:
myArr[0] = 'entry0';
myArr[1] = 'entry1';
... and so forth. It works but is pretty damn ugly- particularly in the case of multiply-dimensioned and shaped arrays. I use JSON when I send data back via AJAX, so I simply combined the two and got nice tight code that I like. After I create <whatever the array is to look like> in PHP, then I json_encode it and place this single line in my outgoing HTML:
brands = eval($theEncodedBrandsString);
What comes out in the final HTML looks like this:
brands = eval({"1":{"name":"Palace Resorts","properties":[{"id":"1","name":"Moon Palace"}]}});
... which is ugly, but wicked fast.
Just a gear turner and

,
/p