php solution
swift solution