some oop with php and javascript