Skip to content

Instantly share code, notes, and snippets.

@erikbgithub
Created January 10, 2010 10:01
Show Gist options
  • Save erikbgithub/273420 to your computer and use it in GitHub Desktop.
Save erikbgithub/273420 to your computer and use it in GitHub Desktop.
function add_classical($nr1, $nr2, $type='decimal'){
$sum = NULL;
switch($type){
case 'decimal':
$sum = (int)$nr1 + (int)$nr2;
case 'binary':
$sum = bindec($nr1) + bindec($nr2);
}
return $sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment