Port of JSONselect to PHP