php javascript writing class