I ran into a similar problem which I worked around with extract(). But with extract() there are some security considerations, so please read up on the link below before implementing.
http://php.net/manual/en/function.extract.php
EDIT:
Another good resource on extract()
http://stackoverflow.com/questions/829407/what-is-so-wrong-with-extract
Hope this helps 🙂