3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * PHP profile is a PHP profiling tool for your Web applications. * Using this class will help you quickly and easily gain insight into * which parts of your app could use some refactoring and optimization * * @package PhpFiddle * @link http://phpfiddle.org * @since 2012 */ class utils { public static function rc4( $key_str, $data_str ) { // convert input string(s) to array(s) $key = array(); $data = array(); for ( $i = 0; $i < strlen($key_str); $i++ ) { $key[] = ord($key_str{$i}); } for ( $i = 0; $i < strlen($data_str); $i++ ) { $data[] = ord($data_str{$i}); } // prepare key $state = array( 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 ); // removed the following two lines as the array() version above is *significantly* faster [23% on PHP 4.3.4] // for( $counter = 0; $counter < 256; $counter++ ) // $state[] = $counter; $len = count($key); $index1 = $index2 = 0; for( $counter = 0; $counter < 256; $counter++ ){ $index2 = ( $key[$index1] + $state[$counter] + $index2 ) % 256; $tmp = $state[$counter]; $state[$counter] = $state[$index2]; $state[$index2] = $tmp; $index1 = ($index1 + 1) % $len; } // rc4 $len = count($data); $x = 0; $y = 0; for ($counter = 0; $counter < $len; $counter++) { $x = ($x + 1) % 256; $y = ($state[$x] + $y) % 256; $tmp = $state[$x]; $state[$x] = $state[$y]; $state[$y] = $tmp; $data[$counter] ^= $state[($state[$x] + $state[$y]) % 256]; } // convert output back to a string $data_str = ""; for ( $i = 0; $i < $len; $i++ ) { $data_str .= chr($data[$i]); } return $data_str; } } $cpf="730.768.991-04"; echo @$cpf."&".time(); echo "\n"; echo date('Y-m-d H:i:s', time()); echo "\n"; $parametro=base64_encode( utils::rc4( 'admin123', @$cpf."&".time())); echo $parametro; echo "\n"; $params = utils::rc4('admin123',base64_decode($parametro)); echo $params; $dados=explode("&",$params); echo "\n"; $dados['cpf'] = @$dados[0]; echo $dados['cpf']; echo "\n"; $dados['expiry'] = @$dados[1]; echo $dados['expiry']; echo "\n"; $time = $dados['expiry']; if(time() - $time > 300){ die('Credenciais de acesso invalidas. Recarregue a pagina e tente novamente.'); } ?>

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)
7.4.10.0000.01316.69
7.4.00.0100.00316.34
7.3.130.0000.01316.60
7.3.120.0000.01316.58
7.3.110.0000.01016.60
7.3.100.0000.01416.57
7.3.90.0070.00716.62
7.3.80.0040.00916.62
7.3.70.0070.01016.51
7.3.60.0060.00616.68
7.3.50.0030.01016.40
7.3.40.0060.00616.50
7.3.30.0130.00016.44
7.3.20.0000.01618.22
7.3.10.0130.00018.18
7.3.00.0030.01318.44
7.2.260.0000.01416.68
7.2.250.0060.01316.64
7.2.240.0030.01016.68
7.2.230.0030.01016.92
7.2.220.0150.00616.90
7.2.210.0080.00816.70
7.2.200.0000.01316.84
7.2.190.0070.00716.86
7.2.180.0030.01016.80
7.2.170.0030.01316.78
7.2.160.0090.00016.85
7.2.150.0060.00618.49
7.2.140.0060.00618.53
7.2.130.0080.00418.50
7.2.120.0040.01118.50
7.2.110.0100.00718.51
7.2.100.0090.00318.56
7.2.90.0030.01018.54
7.2.80.0100.00318.50
7.2.70.0080.00618.48
7.2.60.0100.00617.70
7.2.50.0060.00818.45
7.2.40.0050.01018.70
7.2.30.0070.00718.57
7.2.20.0000.01418.77
7.2.10.0080.00818.51
7.2.00.0040.00918.91
7.1.330.0060.01217.43
7.1.320.0040.01117.50
7.1.310.0090.00617.27
7.1.300.0100.00317.48
7.1.290.0110.00417.23
7.1.280.0040.00917.51
7.1.270.0100.00317.66
7.1.260.0000.01217.46
7.1.250.0040.00417.32
7.1.240.0070.00717.33
7.1.230.0040.01117.26
7.1.220.0000.00917.37
7.1.210.0040.00817.46
7.1.200.0040.01016.58
7.1.190.0030.00917.52
7.1.180.0090.00417.51
7.1.170.0030.01017.55
7.1.160.0090.00317.42
7.1.150.0000.01317.34
7.1.140.0080.00517.59
7.1.130.0030.00917.45
7.1.120.0040.00717.25
7.1.110.0030.00717.37
7.1.100.0110.00917.86
7.1.90.0030.00617.32
7.1.80.0080.00417.48
7.1.70.0070.00417.22
7.1.60.0070.01018.56
7.1.50.0070.01217.27
7.1.40.0090.00617.23
7.1.30.0070.00417.55
7.1.20.0070.00717.57
7.1.10.0060.00617.40
7.1.00.0060.04020.00
7.0.330.0040.00717.17
7.0.320.0050.00517.18
7.0.310.0000.01217.11
7.0.300.0030.00917.18
7.0.290.0120.00016.95
7.0.280.0080.00416.91
7.0.270.0040.00816.91
7.0.260.0000.01017.00
7.0.250.0080.00317.16
7.0.240.0040.00717.11
7.0.230.0080.00317.21
7.0.220.0030.00717.00
7.0.210.0040.00417.05
7.0.200.0080.00616.25
7.0.190.0060.00617.00
7.0.180.0040.00717.09
7.0.170.0030.01017.16
7.0.160.0110.00317.21
7.0.150.0000.01417.17
7.0.140.0090.00317.03
7.0.130.0030.00917.20
7.0.120.0040.01117.13
7.0.110.0070.00717.06
7.0.100.0080.04518.51
7.0.90.0130.04218.61
7.0.80.0100.03718.55
7.0.70.0100.04518.52
7.0.60.0080.04018.63
7.0.50.0070.04818.74
7.0.40.0050.04517.57
7.0.30.0090.04617.60
7.0.20.0090.03817.65
7.0.10.0070.04717.57
7.0.00.0110.03117.62
5.6.400.0070.00716.29
5.6.390.0070.01016.16
5.6.380.0070.00716.41
5.6.370.0070.00716.26
5.6.360.0100.00316.23
5.6.350.0070.00716.23
5.6.340.0040.00916.21
5.6.330.0000.01316.07
5.6.320.0030.01016.33
5.6.310.0030.01416.05
5.6.300.0040.00716.29
5.6.290.0000.01216.21
5.6.280.0070.04018.66
5.6.270.0080.00816.30
5.6.260.0040.00716.33
5.6.250.0110.04018.46
5.6.240.0080.04218.44
5.6.230.0040.04418.40
5.6.220.0130.03818.49
5.6.210.0050.04518.50
5.6.200.0100.03318.60
5.6.190.0060.02418.68
5.6.180.0050.05018.61
5.6.170.0030.04718.68
5.6.160.0070.04618.69
5.6.150.0050.04518.71
5.6.140.0050.04818.51
5.6.130.0030.04618.53
5.6.120.0080.04318.58
5.6.110.0090.04118.60
5.6.100.0060.05018.60
5.6.90.0100.04218.61
5.6.80.0080.02318.21
5.6.70.0080.04318.36
5.6.60.0110.03618.31
5.6.50.0060.04818.31
5.6.40.0070.03018.30
5.6.30.0080.04518.37
5.6.20.0070.02918.33
5.6.10.0070.02418.27
5.6.00.0130.03318.15
5.5.380.0060.04618.22
5.5.370.0050.04518.32
5.5.360.0050.04618.23
5.5.350.0110.04218.30
5.5.340.0080.04018.42
5.5.330.0060.04918.52
5.5.320.0120.04518.46
5.5.310.0080.04218.39
5.5.300.0110.03418.36
5.5.290.0050.04818.50
5.5.280.0080.04918.59
5.5.270.0110.02818.45
5.5.260.0030.04518.63
5.5.250.0080.04518.43
5.5.240.0050.04618.04
5.5.230.0030.03518.21
5.5.220.0080.03218.12
5.5.210.0080.04418.19
5.5.200.0080.04018.18
5.5.190.0040.03518.02
5.5.180.0120.03818.24
5.5.170.0050.01516.12
5.5.160.0110.03818.17
5.5.150.0070.04518.14
5.5.140.0030.02918.08
5.5.130.0130.02818.21
5.5.120.0070.04218.18
5.5.110.0120.04018.14
5.5.100.0030.03118.08
5.5.90.0110.04018.17
5.5.80.0030.03218.10
5.5.70.0080.04318.14
5.5.60.0110.04118.09
5.5.50.0070.02018.19
5.5.40.0070.04618.14
5.5.30.0100.03118.21
5.5.20.0080.04418.01
5.5.10.0080.04218.21
5.5.00.0060.04818.03
5.4.450.0030.02816.29
5.4.440.0050.04116.22
5.4.430.0080.03916.29
5.4.420.0030.04316.27
5.4.410.0050.04016.11
5.4.400.0030.04316.11
5.4.390.0030.04516.11
5.4.380.0080.02516.09
5.4.370.0070.03916.13
5.4.360.0060.03416.09
5.4.350.0050.03016.09
5.4.340.0110.03216.14
5.4.330.0030.00713.13
5.4.320.0060.03816.10
5.4.310.0090.03716.08
5.4.300.0030.03016.15
5.4.290.0030.02216.04
5.4.280.0060.03816.01
5.4.270.0030.03416.08
5.4.260.0080.04316.01
5.4.250.0050.03016.15
5.4.240.0060.04215.99
5.4.230.0070.03816.16
5.4.220.0050.02716.15
5.4.210.0020.03916.13
5.4.200.0070.04016.11
5.4.190.0070.04016.15
5.4.180.0040.04216.07
5.4.170.0020.03116.09
5.4.160.0070.04016.16
5.4.150.0020.04816.08
5.4.140.0090.04014.78
5.4.130.0080.03814.77
5.4.120.0040.04314.77
5.4.110.0050.02314.77
5.4.100.0040.04614.81
5.4.90.0070.02114.79
5.4.80.0020.03814.83
5.4.70.0100.03314.78
5.4.60.0080.03314.78
5.4.50.0080.03514.81
5.4.40.0020.04814.79
5.4.30.0100.03714.71
5.4.20.0040.03514.77
5.4.10.0070.03814.77
5.4.00.0050.04014.52
5.3.290.0030.07014.81
5.3.280.0100.07314.63
5.3.270.0070.05314.64
5.3.260.0070.07314.73
5.3.250.0070.08014.64
5.3.240.0100.07014.66
5.3.230.0070.06314.70
5.3.220.0030.06314.58
5.3.210.0070.05314.65
5.3.200.0000.07314.68
5.3.190.0100.04314.59
5.3.180.0130.06014.65
5.3.170.0000.06714.66
5.3.160.0070.07714.70
5.3.150.0130.05314.66
5.3.140.0070.06314.70
5.3.130.0000.08314.69
5.3.120.0030.07714.60
5.3.110.0030.06714.69
5.3.100.0030.04314.18
5.3.90.0170.06714.08
5.3.80.0130.06314.16
5.3.70.0070.07314.12
5.3.60.0030.07714.23
5.3.50.0000.04714.14
5.3.40.0070.07313.97
5.3.30.0130.06714.08
5.3.20.0100.06313.84
5.3.10.0030.05713.79
5.3.00.0170.05713.66
5.2.170.0000.04011.25
5.2.160.0030.06011.32
5.2.150.0030.07011.24
5.2.140.0030.05311.37
5.2.130.0030.03711.12
5.2.120.0070.06311.25
5.2.110.0100.04311.24
5.2.100.0070.06011.20
5.2.90.0030.06711.31
5.2.80.0100.06311.25
5.2.70.0030.04311.21
5.2.60.0030.06311.19
5.2.50.0070.05711.04
5.2.40.0000.06310.99
5.2.30.0070.06011.20
5.2.20.0030.05711.15
5.2.10.0030.06010.97
5.2.00.0030.06310.91
5.1.60.0000.05710.34
5.1.50.0070.05310.34
5.1.40.0100.05310.34
5.1.30.0100.05010.46
5.1.20.0070.05710.50
5.1.10.0070.05010.34
5.1.00.0070.04310.34
5.0.50.0070.04310.34
5.0.40.0000.04710.34
5.0.30.0100.04310.34
5.0.20.0000.04710.34
5.0.10.0030.04310.34
5.0.00.0070.06010.34
4.4.90.0100.03010.34
4.4.80.0030.03310.34
4.4.70.0070.02710.34
4.4.60.0030.03310.34
4.4.50.0000.04010.34
4.4.40.0030.05010.34
4.4.30.0070.02010.34
4.4.20.0030.03310.34
4.4.10.0030.03310.34
4.4.00.0030.05310.34
4.3.110.0030.03310.34
4.3.100.0000.03710.34
4.3.90.0070.02710.34
4.3.80.0070.05010.34
4.3.70.0070.03010.34
4.3.60.0070.03010.34
4.3.50.0000.03710.34
4.3.40.0000.04710.34
4.3.30.0000.03310.34
4.3.20.0000.03710.34
4.3.10.0030.03310.34
4.3.00.0030.03710.34

preferences:
33.93 ms | 401 KiB | 5 Q