working on the logic php programming