Created
October 27, 2011 14:47
-
-
Save LinuxDoku/1319745 to your computer and use it in GitHub Desktop.
Dualzahlen zu Dezimalzahlen umrechnen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$numbers = str_split('101110111010'); | |
$result = 0; | |
foreach($numbers as $number) { | |
$result *= 2; | |
$result += $numbers[array_search($number, $numbers) + 1]; | |
} | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment