Sometimes you can get it out. Even if it was glued.
Cut the pipe flush with the fitting. Next, take a hacksaw blade. Only the blade, no handle and stick the end of the blade into the fitting and cut the pipe down to the fitting. This is the tricky part. You want to cut the pipe thru but not into the fitting to much. You need to cut about 3 times, roughly thirds.
Next, take a SMALL flat screwdriver and put it between the fitting and the pipe. Use a small hammer or something like channel lock pliers and tap on the screwdriver, wedging it in between. You need to do this next to a cut you made. If you do it right and it was not glued with primer there is a good chance you can get the pipe to peel out as you go. Sometimes pieces will break off and you have to get them out later. Try and get the big pieces first. Leave all the small ones to the end.
Then you can use some primer to soften the pvc and pop the small ones out. Sometimes it digs into the fitting to much. If it does, it is over and you have to buy what you need.