Php Iterate Over Key Value Javascript Array Splice