<?php
$element = (object)array();
function pq($e)
{
return new M($e);
}
class M
{
public function __construct($e) { }
public function attr($a) { return $this; }
public function html() { return "OK"; }
}
$var='pq($element)->attr(\'href\')->html()';
eval('$out='.$var.";");
var_dump($out);