well if you ever want to toggle any 1 bit value (i.e 0 or 1) you can just "NOT" it. e.g.:
$x=0;
$x=(!$x); // so x is now 1
$x=(!$x); // now x is 0 again...
so, if you use this with attributes:
setAttr pPlane1.visibility (!getAttr pPlane1.visibility
)
the same line (button/hotkey) will toggle the attribute value, in this case visibility.
hope this helps you solve your problem..!
:nathaN