In the vast majority of jobs (IMHO), the speed at which they can write a given function/whatever has almost no bearing on their overall productivity. Most coders only program a few hours a day anyway (see: https://news.ycombinator.com/item?id=8131116) ...it's what they're doing the rest of the time that matters most.
If you have a need to do a timed test, at least do it in pseudocode. That way you're just testing the applicant's logic, instead of how much [php/js/ruby/whatever] they happened to memorize over the years.