At one level, this horrifies me.<p>At another level, I'm always impressed by how PHPers just do it. Whatever it is, you always just seem to get from A to B and have something up and running. You guys are like the weaver ants of the programming world.
I have been using this reliably for over a year now. They have the bulk of the functions already done that you'd want: <a href="http://phpjs.org/statistics/index" rel="nofollow">http://phpjs.org/statistics/index</a> . Extra nice: you can download the js one function at a time, if you so choose. Similar alternative for date(): <a href="http://www.svendtofte.com/javascript/javascript-date-string-formatting/" rel="nofollow">http://www.svendtofte.com/javascript/javascript-date-string-...</a>
Thanks for posting this. Regardless of the attitude towards PHP on HN, this looks a very solid library, making my life easier. I hate having to create my own JS functions for search, replace, trim etc., let alone easy to use date functions.
I don't know if I understand this. The Library is HUGE(Yes, I know you can compile your own package), the minified version is over 100KB. Thats 100KB to have JavaScript functions using PHP syntax, many of which duplicate functions that already exist as part of JavaScript.<p>I'm not down on PHP or anything, but much of this seems redundant and a waste of time.
This is an excellent tool to get things up and running on the client side for the large number of people who are fluent and proficient in PHP.<p>Even if you are concerned about efficiency, it is still excellent as a fast prototyping method, where you get something up and running so you can interact with it, test new ideas, and so on.
Reading the implementation of these functions is truly enjoyable. "echo" implements its own XML parser! (I wish I was making that up.)<p>The writing style the docs use is also nice. The developers are always referred to as "rock stars", and the examples are always in the form "If you write ..., it <i>could return</i> ...". could return? Nice.
Not to be the hater in this thread, but I bet this was made by a bitter JS developer who saw how jQuery undid most the evils of Javascript and felt that the "damage" had to be rectified.<p>To add something constructive to the debate, I'll just toss in that this goes right in the face of good API design, not as a cheap pun because it's PHP, but because it's a PHP API transliterated into a language <i>not</i> PHP.
And now that php is going to have cleaner anonymous functions we'll end up with some sort of pquery. but with more -> and Array( all over the place.<p>P("db_table.name")->filter(function($x, $y){return $x > $y;});