Vinu Thomas has mentioned a project that is trying to port as many of the standard PHP functions over to Javascript as possible - PHP.JS.
PHP programmers usually have to handle HTML & Javascript front-end coding as well and I’m sure a lot of us have been frustrated with the lack of those easy to use PHP functions in Javascript like those array, encode/decode and string functions. Here’s a Javascript project which provides you just that.
The project currently has over two hundred and thirty functions ported and put into a single, easy to download library (with three versions - normal, mini and packed). Then you're just a script tag away from including it and putting it to good use. You can find out more on the PHP.JS homepage.