3v4l.org

run code in 300+ PHP versions simultaneously
<?php class base58 { static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; public static function encode($int) { $base58_string = ""; $base = strlen(self::$alphabet); while($int >= $base) { $div = floor($int / $base); $mod = ($int - ($base * $div)); // php's % is broke with >32bit int on 32bit proc $base58_string = self::$alphabet{$mod} . $base58_string; $int = $div; } if($int) $base58_string = self::$alphabet{$int} . $base58_string; return $base58_string; } public static function decode($base58) { $int_val = 0; for($i=strlen($base58)-1,$j=1,$base=strlen(self::$alphabet);$i>=0;$i--,$j*=$base) { $int_val += $j * strpos(self::$alphabet, $base58{$i}); } return $int_val; } } echo "http://flic.kr/p/" . base58::encode(3392387861) . "\n";
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/saFGB on line 12
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/saFGB on line 12 Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/saFGB on line 15 Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/saFGB on line 22 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 15 http://flic.kr/p/6aLSHT
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 7.3.32 - 7.3.33
http://flic.kr/p/6aLSHT
Output for 5.4.5 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31
Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 12 Notice: String offset cast occurred in /in/saFGB on line 15 http://flic.kr/p/6aLSHT
Output for 5.4.0 - 5.4.4
Notice: String offset cast occured in /in/saFGB on line 12 Notice: String offset cast occured in /in/saFGB on line 12 Notice: String offset cast occured in /in/saFGB on line 12 Notice: String offset cast occured in /in/saFGB on line 12 Notice: String offset cast occured in /in/saFGB on line 12 Notice: String offset cast occured in /in/saFGB on line 15 http://flic.kr/p/6aLSHT
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/saFGB</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/saFGB</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/saFGB</b> on line <b>4</b><br />
Process exited with code 255.

preferences:
323.63 ms | 402 KiB | 460 Q