Skip to content

Instantly share code, notes, and snippets.

@jeremejazz
Created June 20, 2014 01:21
Show Gist options
  • Save jeremejazz/f0261bd6e79dc8f82983 to your computer and use it in GitHub Desktop.
Save jeremejazz/f0261bd6e79dc8f82983 to your computer and use it in GitHub Desktop.
Swap two integers without 3rd integer
<?php
a = 10;
b = 20;
a = a + b; // a = 30
b = a - b; // b = 10
a = a - b; // a = 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment