3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function from62to10($num) { $from = 62; $num = strval($num); $dict = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $len = strlen($num); $dec = 0; for($i = 0; $i < $len; $i++) { $pos = strpos($dict, $num[$i]); $dec = bcadd(bcmul(bcpow($from, $len - $i - 1), $pos), $dec); } return $dec; } function decode($url) { $file = basename($url,'.jpg'); $code = substr($file, 0, 8); if (substr($code, 0, 2) == '00') { return from62to10($code); } else { return hexdec($code); } } $url = 'http://ww3.sinaimg.cn/large/0060lm7Tly1fj8dcbq7bcj30f0076jr7.jpg'; $weibo = 'http://weibo.com/u/' . decode($url); echo $weibo;
based on KLtPk
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.2.8, 7.3.0rc3
http://weibo.com/u/5501886937
Output for 7.3.0alpha1 - 7.3.0beta1
Fatal error: Uncaught Error: Call to undefined function bcadd() in /in/2J3FH:13 Stack trace: #0 /in/2J3FH(22): from62to10('0060lm7T') #1 /in/2J3FH(30): decode('http://ww3.sina...') #2 {main} thrown in /in/2J3FH on line 13
Process exited with code 255.