added PHP logic