"Huh. $templates is now a number? That's weird: it's supposed to be an array. What happened?"

...

"Okay, so I assigned whatever returned from array_unshift() to be $templates. What did it return? I should RTFM."

array_unshift

(PHP 4, PHP 5)
array_unshift — Prepend one or more elements to the beginning of an array

Description

int array_unshift ( array &$array , mixed $value1 [, mixed $... ] )
array_unshift() prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.

"Why does it say int there? What int is it returning? And why is there an ampersand next to $array?"

Return Values

Returns the new number of elements in the array.

"Oh. So how do I get the modified array? OH! That's what the ampersand means: $array is a reference so array_unshift() will modify the array I passed in. That means I just call the function and that's it!"

"Yay, that particular problem is solved! I'm so glad I looked at the documentation - it only took me a couple minutes to figure it out for myself! That's much faster than the half-hour I could expect to get on Dev Shed."