3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Encryption { var $skey = 'SuPerEncKey2010'; // you can change it public function safe_b64encode($string) { $data = base64_encode($string); $data = str_replace(array('+','/','='),array('-','_',''),$data); return $data; } public function safe_b64decode($string) { $data = str_replace(array('-','_'),array('+','/'),$string); $mod4 = strlen($data) % 4; if ($mod4) { $data .= substr('====', $mod4); } return base64_decode($data); } public function encode($value){ if(!$value){return false;} $text = $value; $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv); return trim($this->safe_b64encode($crypttext)); } public function decode($value){ if(!$value){return false;} $crypttext = $this->safe_b64decode($value); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv); return trim($decrypttext); } }; encrypt->encode('wong pinter');

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.6.110.0100.08021.13
5.6.100.0130.07321.04
5.6.90.0070.07721.09
5.6.80.0070.07720.54
5.5.270.0100.05320.80
5.5.260.0130.08020.86
5.5.250.0170.07020.56
5.5.240.0100.07020.30
5.4.430.0670.05019.41
5.4.420.0700.00019.34
5.4.410.0630.00019.45
5.4.400.0630.00019.13
5.4.390.0600.00019.09
5.4.380.0830.00019.09
5.4.370.0770.00019.04
5.4.360.0630.00018.98
5.4.350.0670.00018.99
5.4.340.0670.00019.11
5.4.320.0630.00019.11
5.4.310.0670.00019.06
5.4.300.0670.00019.13
5.4.290.0630.00019.02
5.4.280.0830.00019.15
5.4.270.0870.00019.15
5.4.260.0830.00019.20
5.4.250.0670.00019.02
5.4.240.0670.00019.20
5.4.230.0600.00019.20
5.4.220.0670.00018.98
5.4.210.0670.00019.03
5.4.200.0600.00016.64
5.4.190.0670.00018.96
5.4.180.0600.00019.00
5.4.170.0670.00019.02
5.4.160.0630.00019.14
5.4.150.0670.00019.10
5.4.140.0670.00016.38
5.4.130.0670.00016.30
5.4.120.0700.00016.34
5.4.110.0630.00016.32
5.4.100.0600.00016.67
5.4.90.0570.00016.68
5.4.80.0570.00016.28
5.4.70.0600.00016.46
5.4.60.0600.00016.68
5.4.50.0600.00016.45
5.4.40.0600.00016.60
5.4.30.0570.00016.54
5.4.20.0570.00016.59
5.4.10.0570.00016.62
5.4.00.0570.00015.76
5.3.290.0600.00014.60
5.3.280.0600.00014.46
5.3.270.0700.00014.47
5.3.260.0630.00014.78
5.3.250.0600.00014.58
5.3.240.0600.00014.68
5.3.230.0600.00014.54
5.3.220.0600.00014.57
5.3.210.0630.00014.50
5.3.200.0600.00014.49
5.3.190.0600.00014.61
5.3.180.0600.00014.50
5.3.170.0630.00014.43
5.3.160.0600.00014.56
5.3.150.0600.00014.74
5.3.140.0600.00014.48
5.3.130.0630.00014.46
5.3.120.0630.00014.63
5.3.110.0630.00014.48
5.3.100.0600.00013.91
5.3.90.0600.00014.09
5.3.80.0600.00013.99
5.3.70.0630.00014.04
5.3.60.0570.00014.01
5.3.50.0600.00013.94
5.3.40.0600.00013.94
5.3.30.0570.00013.82
5.3.20.0600.00013.69
5.3.10.0570.00013.68
5.3.00.0600.00013.80
5.2.170.0500.00011.11
5.2.160.0470.00011.01
5.2.150.0500.00011.23
5.2.140.0500.00011.32
5.2.130.0470.00011.10
5.2.120.0470.00011.19
5.2.110.0470.00011.04
5.2.100.0600.00011.17
5.2.90.0470.00011.23
5.2.80.0470.00011.02
5.2.70.0500.00011.02
5.2.60.0470.00011.07
5.2.50.0470.00011.02
5.2.40.0470.00010.98
5.2.30.0470.00010.89
5.2.20.0470.00011.04
5.2.10.0470.00010.95
5.2.00.0470.00010.59
5.1.60.0400.00010.00
5.1.50.0400.00010.07
5.1.40.0400.0009.88
5.1.30.0430.00010.34
5.1.20.0400.00010.32
5.1.10.0400.00010.13
5.1.00.0400.00010.20
5.0.50.0330.0008.48
5.0.40.0330.0008.59
5.0.30.0470.0008.30
5.0.20.0300.0008.33
5.0.10.0300.0008.33
5.0.00.0470.0008.29
4.4.90.0230.0005.79
4.4.80.0270.0005.88
4.4.70.0230.0005.76
4.4.60.0230.0005.88
4.4.50.0230.0005.84
4.4.40.0370.0005.84
4.4.30.0230.0005.87
4.4.20.0230.0005.91
4.4.10.0230.0005.91
4.4.00.0400.0005.90
4.3.110.0230.0005.82
4.3.100.0230.0005.68
4.3.90.0230.0005.64
4.3.80.0370.0005.74
4.3.70.0230.0005.67
4.3.60.0230.0005.78
4.3.50.0230.0005.68
4.3.40.0370.0005.74
4.3.30.0270.0004.52
4.3.20.0230.0004.50
4.3.10.0230.0004.46
4.3.00.0130.01716.24

preferences:
38.41 ms | 400 KiB | 5 Q