First, we need to know the atomic number of each element, we look for it at the periodic table:
S is 16
Al is 13
P is 15
So:
If you have S²⁻, that means the S gained 2 electrons.
The neutral atom of S has 16 electrons (because of the atomic number)
So if it gained 2 eletrons, S²⁻ have 18 electrons.
We will do the same for the Al³⁺ and P³⁻:
Al³⁺ means that Al lose 3 electrons.
The neutral atom of Al is 13, if it loses 3 electrons, Al³⁺ have 10 electrons.
The neutral atom of P is 15, if it gains 3 electrons, P³⁻ have 18 electrons.
Now we need to make the electronic distribution of each ion:
S²⁻ - 1s² 2s² 2p⁶ 3s² 3p⁶
Al³⁺ - 1s² 2s² 2p⁶
P³⁻ - 1s² 2s² 2p⁶ 3s² 3p⁶
So: S²⁻ and P³⁻ have the same electron configuration.