3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bijective { /** * * @var string */ private $dictionary = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; /** * CTOR */ public function __construct() { $this->dictionary = str_split($this->dictionary); } /** * * @param int $i * @return string */ public function encode($i) { if ($i == 0) return $this->dictionary[0]; $result = ''; $base = count($this->dictionary); while ($i > 0) { $result[] = $this->dictionary[($i % $base)]; $i = floor($i / $base); } $result = array_reverse($result); return join("", $result); } /** * * @param string $input * @return int */ public function decode($input) { $i = 0; $base = count($this->dictionary); $input = str_split($input); foreach ($input as $char) { $pos = array_search($char, $this->dictionary); $i = $i * $base + $pos; } return $i; } } $b=new Bijective(); echo $b->decode('d5iskrr'):

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.120.0160.04112.01
5.4.110.0150.04312.00
5.4.100.0140.04412.00
5.4.90.0140.04612.00
5.4.80.0370.08312.00
5.4.70.0130.04512.00
5.4.60.0180.04112.00
5.4.50.0140.04312.00
5.4.40.0140.04511.99
5.4.30.0130.04711.98
5.4.20.0260.06411.98
5.4.10.0210.05011.98
5.4.00.0190.06911.48
5.3.220.0150.04612.68
5.3.210.0160.04312.68
5.3.200.0200.04012.68
5.3.190.0190.04312.68
5.3.180.0190.04212.67
5.3.170.0210.07012.66
5.3.160.0180.04712.67
5.3.150.0200.04212.67
5.3.140.0200.04412.66
5.3.130.0210.04012.66
5.3.120.0190.04412.66
5.3.110.0290.07612.66
5.3.100.0140.04712.12
5.3.90.0180.04212.09
5.3.80.0150.04612.08
5.3.70.0210.05612.08
5.3.60.0170.04412.07
5.3.50.0150.04312.01
5.3.40.0260.07912.01
5.3.30.0190.03811.98
5.3.20.0230.06611.75
5.3.10.0160.04211.71
5.3.00.0140.04211.70

preferences:
141.92 ms | 1394 KiB | 7 Q