3v4l.org

run code in 300+ PHP versions simultaneously
<?php $KEY_BASE = str_split("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); print_r($KEY_BASE); $BASE = 62; $num = 11112887; $num = intval($num); $num = array_map('intval',str_split($num)); $result = ''; $remainder = ''; foreach ($num as $digit) { $remainder = $digit%$BASE; $result.=$KEY_BASE[$remainder]; //echo $digit; } echo $result;
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, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 [10] => a [11] => b [12] => c [13] => d [14] => e [15] => f [16] => g [17] => h [18] => i [19] => j [20] => k [21] => l [22] => m [23] => n [24] => o [25] => p [26] => q [27] => r [28] => s [29] => t [30] => u [31] => v [32] => w [33] => x [34] => y [35] => z [36] => A [37] => B [38] => C [39] => D [40] => E [41] => F [42] => G [43] => H [44] => I [45] => J [46] => K [47] => L [48] => M [49] => N [50] => O [51] => P [52] => Q [53] => R [54] => S [55] => T [56] => U [57] => V [58] => W [59] => X [60] => Y [61] => Z ) 11112887
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/aJ7tq on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/aJ7tq on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/aJ7tq on line 2

preferences:
242 ms | 401 KiB | 371 Q