The electron configuration of #""_15P# is:

#""_15P: 1s^(2)2s^(2)2p^(6)3s^(2)3p^(3)#

When phosphorous gains #3# electrons to form the ion #P^(3-)# the electron configuration becomes:

#""_15P^(3-): 1s^(2)2s^(2)2p^(6)3s^(2)3p^(6)#

The electron configuration of #""_42Mo# is:

#""_42Mo: 1s^(2)2s^(2)2p^(6)3s^(2)3p^(6)4s^(2)3d^(10)4p^(6)5s^(color(green)(2))4d^(color(green)(4))#

When Molybdenum loses #3# electrons to form the ion #Mo^(3+)# the electron configuration becomes:

#""_42Mo^(3+): 1s^(2)2s^(2)2p^(6)3s^(2)3p^(6)4s^(2)3d^(10)4p^(6)5s^(color(red)(0))4d^(color(red)(3))#

Some people they get confused and remove the #3# electrons from #4d^(4)# first, however, the electrons will be removed from #5s^(2)# first and the remaining #1# electron will be removed from #4d^(4)#.

You should keep in mind that the #5s# orbital gets filled before the #4d# orbital, however, when removing electrons; the electrons will be removed from #5s# first.