I'm new to this concept as well, but I understand that it's more about putting css and javascript together I think. joomla.com has lots of javascript files being called from php.
As I understand it Javascript can be used to stabilize popout menus styled with css. Css has a habit of closing the pop-out menu when your mouse strays from the container. So the programer uses javascript to keep the pop-out menu open.
There are several other reasons to use javascript to enhance a template. I didn't understand it at first either, and asked someone in chat to explain why they would use javascript with php, and their answer was.
Javascript happens!
I've got to make a t-shirt with that on it. haha.
Now, is there a means of using php to stabilize a pop-out menu?