Php Remove Last Element Of Array Javascript Push To Beginning