jueves, 12 de junio de 2008

Manipulating PHP arrays with SQL

With toolkits like LINQ for .NET and the subsequant PHPLinq (thanks Nick), we're always looking for more power to manipulate data in-memory rather than writing one-off algorithms to do whatever commonly used sorting, ordering & manipulation you need.

Trent Richardson created a very small and simple JsonSQL library for JavaScript which allows you to run an extremely limited subset of SQL against a Json array/object.

I quickly ported it over to PHP 5 and it works like a charm, although the syntax for the WHERE clause isn't exactly the same but the rest ported across properly.

(more...)

No hay comentarios: