Array Find And Replace Javascript Array Foreach Break In Php