3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function base58_encode($num) { $alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; $base_count = strlen($alphabet); $encoded = ''; while ($num >= $base_count) { $div = $num / $base_count; $mod = ($num - ($base_count * intval($div))); $encoded = $alphabet[$mod] . $encoded; $num = intval($div); } if ($num) { $encoded = $alphabet[$num] . $encoded; } return $encoded; } function base58_decode($num) { $alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; $len = strlen($num); $decoded = 0; $multi = 1; for ($i = $len - 1; $i >= 0; $i--) { $decoded += $multi * strpos($alphabet, $num[$i]); $multi = $multi * strlen($alphabet); } return $decoded; } echo base58_decode("3jf"); echo base58_decode("Jkf");
Output for 4.3.0 - 7.1.0
7786142404