Magnesium phosphide (Mg3P2 or P2Mg3) is IONIC because it is a combination of a metal and nonmetal.
Each magnesium, of which there are three, LOSES two electrons each to become +2 charged
Each phosphorus atom, of which there are two, GAINS three electrons each to become 3 charged.
They are held together with an ionic bond and we use square brackets to show their charge in the lewis dot diagram.
Check me out: http://www.chemistnate.com