expanding php implementation