PHP Shortcut to Set Two Values at Once
I’ve been coding in php for seven years, and doing it professionally for four. Until today, I never knew you could use a syntax like this to set the value of more than one variable.
1 |
[crayon-60107b0b88679057437021 inline="true" ]$variable_x = $variable_y = 0; |
[/crayon]
I’m not sure why I’m so giddy about finding this shortcut. Is it really so much more troublesome to type out something like,
1 2 |
[crayon-60107b0b8868c956693476 inline="true" ]$variable_x = 0; $variable_y = 0; |
[/crayon]
It took two extra keystrokes. A semicolon and a stroke of the enter key. But for some reason, I’m giddy like a schoolgirl.