php redo part 1
convert to php part 2