now with php solutions to the code as well