3v4l.org

run code in 300+ PHP versions simultaneously
<? class BigAndSmallStep { public $f; public $b; public $n; public $a; public $L1 = array(); public $L2 = array(); public $findStr; public $result; public function __construct ($f, $b, $n) { $this->f = intval($f); $this->b = intval($b); $this->n = intval($n); $this->a = self::countA($this->n); } function countA($n) { return ceil(sqrt($n)); } function countL1() { $c = $this->a-1; $i = 0; while ( $i <= $c) { $heig = $i * $this->a; //echo $heig."<br/>"; $this->L1[$i] = array($i, $heig, self::countResL1($heig)); $i++; } return true; } function countL2() { $c = $this->a; $i = 0; while ( $i <= $c) { $this->L2[$i] = array($i, self::countResL2($i)); $i++; } return true; } function mod($x, $y) { return fmod($x, $y); } function countResL1($heig) { $number = pow($this->f, $heig); //echo $number."<br>"; return self::mod( $number, $this->n); } function countResL2($heig) { $number = $this->b * (pow($this->f, $heig)); //echo $number."<br>"; return self::mod( $number, $this->n); } function searchRes() { $c = count($this->L1)-1; $i = 0; while ( $i<= $c) { $ser = $this->L1[$i][2]; $res = self::searchValueInL2($ser); if($res !== false) { return $this->findStr = $i."_".$res; } $i++; } return false; } function searchValueInL2($value) { $c = count($this->L2)-1; $i = 0; while ( $i <= $c) { if($this->L2[$i][1] == $value) { return $i; } $i++; } return false; } function finalResult() { $elem = split("_", $this->findStr); $first = self::mod($this->b, $this->n); $heig = $this->L1[$elem[0]][1] - $this->L2[$elem[1]][0]; $this->result = ceil(self:: mod ( pow($this->f,$heig), $first)) ; } function showRiv() { $elem = split("_", $this->findStr); $f_h = ($this->L2[$elem[1]][0] != 1) ? $this->L2[$elem[1]][0] : ' '; echo " ".$this->b." * ".$this->f. "<sup><small>".$f_h."</small></sup> = ". $this->f."<sup><small>".$this->L1[$elem[0]][1]. "</small></sup> mod ". $this->n; } function getResult() { return $this->result; } } $alg = new BigAndSmallStep(2, 11, 13); if ( ($alg->countL1() != false) && ($alg->countL2() !=false )){ $alg->searchRes(); $alg->finalResult(); $alg->showRiv(); echo "<br/> Result x = ".$alg->getResult(); } else echo "Ошибочка =("; ?>

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)
8.3.60.0040.01118.30
8.3.50.0070.00917.25
8.3.40.0060.00918.48
8.3.30.0150.00018.54
8.3.20.0030.00518.61
8.3.10.0060.00320.38
8.3.00.0000.00819.13
8.2.180.0190.00316.63
8.2.170.0070.01322.96
8.2.160.0140.00320.56
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.18
8.2.110.0090.00020.90
8.2.100.0120.00017.66
8.2.90.0080.00019.13
8.2.80.0080.00019.20
8.2.70.0040.00417.25
8.2.60.0040.00417.68
8.2.50.0040.00418.07
8.2.40.0060.00318.03
8.2.30.0040.00417.93
8.2.20.0030.00917.48
8.2.10.0000.00817.58
8.2.00.0060.00617.23
8.1.280.0070.01025.92
8.1.270.0060.00323.99
8.1.260.0000.00726.35
8.1.250.0140.00028.09
8.1.240.0060.00323.86
8.1.230.0060.00622.54
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0030.00617.23
8.1.190.0040.00417.41
8.1.180.0090.00018.10
8.1.170.0080.00018.84
8.1.160.0040.00418.74
8.1.150.0040.00418.45
8.1.140.0040.00417.27
8.1.130.0030.00317.62
8.1.120.0070.00017.34
8.1.110.0000.00817.30
8.1.100.0000.00717.31
8.1.90.0040.00417.38
8.1.80.0040.00417.31
8.1.70.0030.00617.24
8.1.60.0000.00717.32
8.1.50.0000.00717.22
8.1.40.0060.00317.39
8.1.30.0040.00417.40
8.1.20.0000.00817.44
8.1.10.0070.00017.48
8.1.00.0000.00717.41
8.0.300.0000.00818.77
8.0.290.0030.00616.63
8.0.280.0040.00418.41
8.0.270.0030.00317.05
8.0.260.0000.00716.69
8.0.250.0070.00016.82
8.0.240.0030.00616.84
8.0.230.0030.00316.70
8.0.220.0050.00216.77
8.0.210.0070.00216.75
8.0.200.0090.00016.80
8.0.190.0070.00016.88
8.0.180.0000.00716.77
8.0.170.0080.00016.75
8.0.160.0030.00416.73
8.0.150.0040.00416.70
8.0.140.0000.01416.59
8.0.130.0030.00313.66
8.0.120.0000.00716.75
8.0.110.0050.00216.79
8.0.100.0080.00016.64
8.0.90.0000.00816.64
8.0.80.0100.00916.79
8.0.70.0040.00416.65
8.0.60.0000.00716.72
8.0.50.0030.00316.69
8.0.30.0110.00716.98
8.0.20.0090.01316.83
8.0.10.0000.00716.86
8.0.00.0070.01116.70
7.4.330.0050.00013.30
7.4.320.0000.00616.48
7.4.300.0070.00016.40
7.4.290.0040.00416.36
7.4.280.0060.00316.51
7.4.270.0000.00716.29
7.4.260.0000.00513.68
7.4.250.0000.00816.41
7.4.240.0040.00416.45
7.4.230.0000.00616.44
7.4.220.0130.01316.46
7.4.210.0060.01516.39
7.4.200.0030.00316.36
7.4.190.0060.00316.32
7.4.160.0070.00916.39
7.4.150.0070.01316.43
7.4.140.0100.00716.34
7.4.130.0000.01716.25
7.4.120.0110.00616.29
7.4.110.0060.01316.28
7.4.100.0100.00716.49
7.4.90.0030.01316.32
7.4.80.0110.00719.39
7.4.70.0100.00716.55
7.4.60.0090.00616.36
7.4.50.0060.00016.36
7.4.40.0110.00716.31
7.4.30.0100.00616.34
7.4.00.0060.00915.05
7.3.330.0000.00613.68
7.3.320.0000.00613.58
7.3.310.0030.00316.20
7.3.300.0000.00716.14
7.3.290.0060.01016.12
7.3.280.0120.00516.11
7.3.270.0100.00716.43
7.3.260.0150.00416.18
7.3.250.0110.00716.37
7.3.240.0130.00316.43
7.3.230.0060.01016.45
7.3.210.0080.00816.17
7.3.200.0090.00616.18
7.3.190.0100.01016.19
7.3.180.0060.00916.38
7.3.170.0120.00916.07
7.3.160.0150.00016.15
7.3.120.0060.01214.75
7.2.330.0080.00816.36
7.2.320.0060.01216.52
7.2.310.0100.00616.57
7.2.300.0070.01016.52
7.2.290.0030.01416.28
7.2.60.0000.01417.09
7.2.00.0030.00919.55
7.1.200.0060.00616.21
7.1.100.0000.01018.20
7.1.70.0030.00617.44
7.1.60.0070.01819.30
7.1.50.0190.00635.03
7.1.00.0030.03322.61
7.0.200.0040.00417.14
7.0.140.0100.06322.16
7.0.120.0030.06322.28
7.0.60.0170.07020.12
7.0.50.0100.07018.20
7.0.40.0130.07317.94
7.0.30.0030.05717.85
7.0.20.0200.07317.95
7.0.10.0030.08718.03
7.0.00.0070.08317.90
5.6.280.0000.07321.07
5.6.210.0070.05320.80
5.6.200.0170.07018.31
5.6.190.0030.08318.30
5.6.180.0000.04318.47
5.6.170.0170.07318.37
5.6.160.0030.08018.47
5.6.150.0070.08718.32
5.6.140.0070.07718.47
5.6.130.0070.08018.33
5.6.120.0030.08018.36
5.6.110.0100.03718.29
5.6.100.0070.03718.46
5.6.90.0030.04018.27
5.6.80.0000.04017.77
5.6.70.0070.03317.77
5.6.60.0070.03317.65
5.6.50.0070.03317.70
5.6.40.0030.03717.69
5.6.30.0030.04717.80
5.6.20.0030.03717.72
5.6.10.0000.04017.82
5.6.00.0030.03717.70
5.5.350.0270.07720.74
5.5.340.0100.08018.21
5.5.330.0070.08318.11
5.5.320.0100.08018.11
5.5.310.0100.06318.20
5.5.300.0030.07018.10
5.5.290.0070.09018.16
5.5.280.0000.06718.11
5.5.270.0130.03018.21
5.5.260.0000.04318.12
5.5.250.0030.04317.93
5.5.240.0100.03017.59
5.5.230.0070.04717.57
5.5.220.0100.03317.60
5.5.210.0030.03717.57
5.5.200.0030.03717.49
5.5.190.0070.03717.44
5.5.180.0100.03017.55
5.5.160.0030.03717.45
5.5.150.0030.03717.47
5.5.140.0030.03717.52
5.5.130.0030.03717.55
5.5.120.0000.04017.51
5.5.110.0000.04717.52
5.5.100.0030.03717.36
5.5.90.0030.03717.33
5.5.80.0070.03717.44
5.5.70.0070.04017.34
5.5.60.0170.04717.34
5.5.50.0070.07317.32
5.5.40.0070.07317.45
5.5.30.0070.07317.35
5.5.20.0100.04717.44
5.5.10.0100.07717.34
5.5.00.0100.07317.43
5.4.450.0200.04019.58
5.4.440.0000.04319.47
5.4.430.0030.04019.68
5.4.420.0100.05319.55
5.4.410.0030.04719.44
5.4.400.0070.03319.14
5.4.390.0030.03719.07
5.4.380.0070.04319.07
5.4.370.0070.03319.22
5.4.360.0070.04319.17
5.4.350.0000.04019.32
5.4.340.0070.03319.22
5.4.320.0000.04319.14
5.4.310.0030.03719.20
5.4.300.0070.03719.32
5.4.290.0100.03019.45
5.4.280.0030.03719.32
5.4.270.0070.03319.21
5.4.260.0030.03719.24
5.4.250.0030.03719.20
5.4.240.0070.03319.21
5.4.230.0000.04019.21
5.4.220.0000.05319.16
5.4.210.0030.07719.17
5.4.200.0070.06019.45
5.4.190.0000.08319.45
5.4.180.0070.06019.31
5.4.170.0030.05019.16
5.4.160.0030.08019.20
5.4.150.0070.07319.30
5.4.140.0100.07016.42
5.4.130.0070.06016.54
5.4.120.0100.07016.55
5.4.110.0170.06716.66
5.4.100.0100.07316.69
5.4.90.0030.07316.69
5.4.80.0100.06716.65
5.4.70.0130.07016.64
5.4.60.0070.07316.48
5.4.50.0070.05016.68
5.4.40.0170.06716.60
5.4.30.0030.07716.42
5.4.20.0030.07716.60
5.4.10.0000.04316.78
5.4.00.0070.07016.14
5.3.290.0000.04014.60
5.3.280.0030.03714.68
5.3.270.0100.07314.55
5.3.260.0000.05714.68
5.3.250.0030.05014.60
5.3.240.0030.08014.43
5.3.230.0130.07314.52
5.3.220.0000.08014.42
5.3.210.0170.07014.39
5.3.200.0070.06314.53
5.3.190.0030.07714.53
5.3.180.0100.06714.54
5.3.170.0170.04714.52
5.3.160.0030.08014.53
5.3.150.0030.07714.50
5.3.140.0000.07314.46
5.3.130.0100.05714.32
5.3.120.0130.07014.46
5.3.110.0030.05714.50
5.3.100.0030.07714.01
5.3.90.0070.07313.93
5.3.80.0070.06714.08
5.3.70.0130.06713.95
5.3.60.0030.05713.93
5.3.50.0000.04313.84
5.3.40.0000.05013.88
5.3.30.0070.07313.99
5.3.20.0070.03313.67
5.3.10.0070.03313.41
5.3.00.0100.03313.62
5.2.170.0070.02711.15
5.2.160.0000.03711.11
5.2.150.0030.04010.96
5.2.140.0030.04310.92
5.2.130.0000.03710.93
5.2.120.0070.03311.02
5.2.110.0000.03310.88
5.2.100.0100.03010.92
5.2.90.0070.03311.13
5.2.80.0070.03011.04
5.2.70.0070.02711.04
5.2.60.0030.03711.02
5.2.50.0030.03010.80
5.2.40.0030.04311.14
5.2.30.0070.04310.91
5.2.20.0070.03310.85
5.2.10.0070.02711.00
5.2.00.0030.04010.73
5.1.60.0070.0279.96
5.1.50.0070.0279.97
5.1.40.0070.05310.02
5.1.30.0000.06010.32
5.1.20.0030.04010.38
5.1.10.0100.05310.00
5.1.00.0070.05010.04
5.0.50.0070.0439.14
5.0.40.0030.0379.14
5.0.30.0030.0579.14
5.0.20.0000.0479.14
5.0.10.0030.0279.14
5.0.00.0030.0639.14
4.4.90.0000.0179.14
4.4.80.0000.0209.14
4.4.70.0030.0339.14
4.4.60.0030.0339.14
4.4.50.0100.0279.14
4.4.40.0000.0509.14
4.4.30.0000.0339.14
4.4.20.0030.0379.14
4.4.10.0000.0409.14
4.4.00.0000.0509.14
4.3.110.0000.0409.14
4.3.100.0000.0279.14
4.3.90.0030.0239.14
4.3.80.0000.0579.14
4.3.70.0070.0309.14
4.3.60.0000.0379.14
4.3.50.0070.0309.14
4.3.40.0000.0479.14
4.3.30.0030.0209.14
4.3.20.0000.0409.14
4.3.10.0070.0239.14
4.3.00.0030.0379.14

preferences:
85.01 ms | 401 KiB | 5 Q