Is it possible to set multiple variables with one ternary operator?
问题 I was looking to see if it's possible to set multiple variables with one ternary operator. I google'd a bit, but didn't come up with anything. I started testing a few ideas, and found something close -- but also getting some strange behavior; any ideas as to what's going on? And, is it possible to set more than one var in a single ternary operation? If so, is there a proper way of doing it? $i=9; ($i==9)?($w=3|$r=2):($w=7|$r=1); echo 'w= '.$w.' r= '.$r;//w= 3 r= 2 $i=9; ($i==9)?($w=4|$r=2):(