PHP implementation of jQuery