A phenylene diimine capped conjugate of 1,3-calix[4]arene (L) was synthesized and characterized, and its Mg2+ complex has been isolated and characterized. The chemo sensing ensemble of Mg2+ bound L provides distinguishable features of response toward phosphates, viz., HPO42-, P2O74-, and AMP(2-) (Set A) and H2PO4-, ATP(2-), and ADP(2-) (Set B). While the Set A shows the formation of ternary complex, the Set B does not exhibit any intermediate complex, but both show the release of Mg2+ and L at different equivalents. The structures of {L + Mg2+} and its phosphate bound ternary complexes have been established by computational calculations, and the corresponding results agree well with the experimental ones. The microscopy studies show an aggregation-disaggregation phenomenon in the presence of different equivalents of phosphates in both of the sets. Using the fluorescence data, an INHIBIT logic gate has been built.