Skip to content

Instantly share code, notes, and snippets.

@gries
Created December 19, 2014 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gries/eae95ade571e74fd7187 to your computer and use it in GitHub Desktop.
Save gries/eae95ade571e74fd7187 to your computer and use it in GitHub Desktop.
Number systems
<?php
$elementalSystem = new NumberSystem(['earth', 'fire', 'air', 'water']);
$binarySystem = new NumberSystem(['0', '1']);
$number = new Number('fire-fire-earth-air', $elementalSystem, '-');
echo $number->asDecimalString(); // -> 214
$number->convert($binarySystem)->value() // -> 11010110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment