3v4l.org

run code in 300+ PHP versions simultaneously
<?php $chars = [ 'a' => 'c', 'b' => 'd', 'c' => 'a', 'd' => 'e', 'e' => 'b', ]; $original = 'acdcxx'; // Encrypt $encrypted = ''; for ($i = 0; $i < strlen($original); $i++) { // If we find the character in our mapping array, use the mapped character. // If not, let's use the original character. $encrypted .= array_key_exists($original[$i], $chars) ? $chars[$original[$i]] : $original[$i]; } print_r($encrypted); // Decrypt $decrypted = ''; for ($i = 0; $i < strlen($encrypted); $i++) { // Find the correct key $key = array_search($encrypted[$i], $chars); // If the character existed, use the key. // If not, use the original character. $decrypted .= $key !== false ? $key : $encrypted[$i]; } echo PHP_EOL; print_r($decrypted);

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.4.130.0110.01017.96
8.4.120.0100.01122.26
8.4.110.0040.00522.16
8.4.100.0130.01017.68
8.4.90.0040.00520.59
8.4.80.0090.00918.70
8.4.70.0080.01220.38
8.4.60.0150.00720.66
8.4.50.0090.01020.35
8.4.40.0080.00317.64
8.4.30.0090.01017.54
8.4.20.0130.00720.45
8.4.10.0040.00417.57
8.3.260.0100.00916.84
8.3.250.0110.00818.89
8.3.240.0020.00616.51
8.3.230.0120.00716.51
8.3.220.0060.00318.85
8.3.210.0110.00716.44
8.3.200.0040.00516.82
8.3.190.0090.00818.85
8.3.180.0150.00618.63
8.3.170.0040.00417.04
8.3.160.0110.00720.22
8.3.150.0140.00416.42
8.3.140.0050.00317.09
8.3.130.0040.00416.54
8.3.120.0070.00418.85
8.3.110.0050.00520.94
8.3.100.0040.00424.06
8.3.90.0050.00326.77
8.3.80.0030.00717.97
8.3.70.0090.01216.38
8.3.60.0120.00618.55
8.3.50.0100.00717.47
8.3.40.0080.00818.83
8.3.30.0110.00418.67
8.3.20.0050.00318.73
8.3.10.0070.00021.86
8.3.00.0080.00021.88
8.2.290.0050.00517.32
8.2.280.0120.00718.77
8.2.270.0140.00417.49
8.2.260.0080.00016.56
8.2.250.0000.00916.65
8.2.240.0060.00317.34
8.2.230.0040.00422.58
8.2.220.0030.00637.54
8.2.210.0040.00826.77
8.2.200.0060.00316.50
8.2.190.0170.00716.58
8.2.180.0070.01025.92
8.2.170.0040.01518.95
8.2.160.0040.01119.16
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.01126.16
8.2.120.0020.00519.96
8.2.110.0070.01122.11
8.2.100.0040.00817.91
8.2.90.0080.00017.97
8.2.80.0040.00417.97
8.2.70.0080.00017.93
8.2.60.0050.00218.22
8.2.50.0090.00018.10
8.2.40.0060.00322.33
8.2.30.0040.00420.68
8.2.20.0000.00718.17
8.2.10.0000.00718.02
8.2.00.0080.00017.95
8.1.330.0090.00222.09
8.1.320.0130.00617.76
8.1.310.0060.01218.54
8.1.300.0030.00620.25
8.1.290.0060.00330.84
8.1.280.0110.00425.92
8.1.270.0080.00023.99
8.1.260.0060.00326.35
8.1.250.0000.00828.09
8.1.240.0090.00320.68
8.1.230.0080.00320.97
8.1.220.0000.00817.74
8.1.210.0040.00418.93
8.1.200.0050.00317.23
8.1.190.0060.00318.89
8.1.180.0000.00918.10
8.1.170.0050.00318.52
8.1.160.0000.00718.82
8.1.150.0040.00418.81
8.1.140.0040.00418.85
8.1.130.0000.00717.40
8.1.120.0050.00217.34
8.1.110.0070.00017.42
8.1.100.0000.00817.33
8.1.90.0050.00317.32
8.1.80.0050.00217.41
8.1.70.0070.00017.32
8.1.60.0040.00417.59
8.1.50.0120.00417.35
8.1.40.0110.00717.47
8.1.30.0080.00717.58
8.1.20.0080.00717.51
8.1.10.0120.00317.56
8.1.00.0120.00417.48
8.0.300.0040.00419.90
8.0.290.0040.00416.75
8.0.280.0080.00018.34
8.0.270.0000.01016.80
8.0.260.0030.00316.86
8.0.250.0000.00716.88
8.0.240.0030.00616.87
8.0.230.0000.00816.96
8.0.220.0000.00716.85
8.0.210.0070.00016.77
8.0.200.0050.00216.82
8.0.190.0030.00516.81
8.0.180.0060.00816.79
8.0.170.0090.00716.85
8.0.160.0060.00616.81
8.0.150.0070.00516.74
8.0.140.0100.00216.76
8.0.130.0080.00515.61
8.0.120.0130.00216.74
8.0.110.0120.00216.76
8.0.100.0080.00616.77
8.0.90.0090.00516.86
8.0.80.0120.00716.79
8.0.70.0130.00816.71
8.0.60.0120.00816.72
8.0.50.0170.00516.74
8.0.30.0110.00816.93
8.0.20.0100.01017.04
8.0.10.0140.00616.95
8.0.00.0070.00916.92
7.4.330.0000.00615.55
7.4.320.0030.00316.63
7.4.300.0040.00416.61
7.4.290.0120.00316.54
7.4.280.0110.00416.49
7.4.270.0140.00516.54
7.4.260.0110.00716.54
7.4.250.0150.00416.47
7.4.240.0200.00316.50
7.4.230.0170.00516.57
7.4.220.0130.00416.57
7.4.210.0120.00816.59
7.4.200.0130.00816.53
7.4.190.0150.00616.67
7.4.180.0140.00616.66
7.4.160.0110.00716.58
7.4.150.0130.00716.53
7.4.140.0120.00517.17
7.4.130.0130.00616.49
7.4.120.0100.00916.48
7.4.110.0100.00916.54
7.4.100.0110.00816.50
7.4.90.0160.00716.44
7.4.80.0130.00816.87
7.4.70.0160.00516.42
7.4.60.0130.00616.45
7.4.50.0090.00916.36
7.4.40.0120.00816.42
7.4.30.0140.00616.43
7.4.20.0150.00516.49
7.4.10.0100.00916.45
7.4.00.0080.00816.23
7.3.330.0100.00615.24
7.3.320.0100.00615.26
7.3.310.0120.00616.27
7.3.300.0110.00616.28
7.3.290.0160.00616.37
7.3.280.0100.00716.37
7.3.270.0120.00616.31
7.3.260.0120.00716.35
7.3.250.0130.00516.36
7.3.240.0100.00916.42
7.3.230.0120.00616.32
7.3.220.0130.00516.24
7.3.210.0140.00716.23
7.3.200.0140.00816.27
7.3.190.0150.00616.35
7.3.180.0140.00716.30
7.3.170.0110.00816.29
7.3.160.0130.00816.32
7.3.150.0130.00816.27
7.3.140.0150.00616.22
7.3.130.0140.00616.23
7.3.120.0120.00816.21
7.3.110.0100.00816.24
7.3.100.0100.00916.14
7.3.90.0110.00816.39
7.3.80.0100.00916.30
7.3.70.0130.00516.24
7.3.60.0110.00716.34
7.3.50.0150.00416.38
7.3.40.0120.00616.30
7.3.30.0120.00716.38
7.3.20.0160.00616.72
7.3.10.0160.00516.63
7.3.00.0140.00916.71
7.2.340.0170.00516.36
7.2.330.0170.00616.50
7.2.320.0160.00816.49
7.2.310.0150.00716.48
7.2.300.0160.01016.52
7.2.290.0120.01116.47
7.2.280.0160.00716.41
7.2.270.0160.00716.43
7.2.260.0180.00616.46
7.2.250.0160.00616.46
7.2.240.0140.00916.42
7.2.230.0140.01016.42
7.2.220.0160.00616.34
7.2.210.0160.00716.40
7.2.200.0190.00716.48
7.2.190.0130.00916.52
7.2.180.0180.00616.48
7.2.170.0160.00616.58
7.2.160.0150.00716.62
7.2.150.0170.00616.93
7.2.140.0190.00616.93
7.2.130.0190.00817.27
7.2.120.0160.00717.26
7.2.110.0170.00917.28
7.2.100.0870.00916.84
7.2.90.0170.00816.80
7.2.80.0200.00616.63
7.2.70.0210.00816.87
7.2.60.0150.00816.81
7.2.50.0150.00816.86
7.2.40.0210.00716.90
7.2.30.0210.00516.99
7.2.20.0190.00916.94
7.2.10.0240.00716.93
7.2.00.0170.00616.99
7.1.330.0180.00716.18
7.1.320.0210.00616.46
7.1.310.0170.00716.47
7.1.300.0180.00616.42
7.1.290.0200.00716.13
7.1.280.0240.00516.18
7.1.270.0210.00516.09
7.1.260.0180.00716.10
7.1.250.0210.00516.10
7.1.240.0180.00816.07
7.1.230.0200.00516.12
7.1.220.0920.00815.84
7.1.210.0180.00815.72
7.1.200.0530.00715.79
7.1.190.0770.00615.84
7.1.180.0170.00715.74
7.1.170.0250.00715.74
7.1.160.0200.00615.81
7.1.150.0210.00815.76
7.1.140.0340.00815.77
7.1.130.0270.00715.76
7.1.120.0850.00715.79
7.1.110.0160.00815.75
7.1.100.0900.00515.81
7.1.90.0480.00715.72
7.1.80.0210.00715.91
7.1.70.0150.01015.63
7.1.60.0210.00818.41
7.1.50.0400.00918.36
7.1.40.0260.00718.40
7.1.30.0240.00918.39
7.1.20.0380.00618.29
7.1.10.0270.00815.75
7.1.00.0210.00515.77
7.0.330.0160.00815.73
7.0.320.0180.00715.77
7.0.310.0220.00515.72
7.0.300.0180.00615.76
7.0.290.0170.00915.77
7.0.280.0180.00915.75
7.0.270.0170.00715.77
7.0.260.0320.00815.73
7.0.250.0160.00815.89
7.0.240.0180.00815.88
7.0.230.0160.00815.89
7.0.220.0250.00616.16
7.0.210.0160.00916.14
7.0.200.0170.00816.18
7.0.190.0150.00916.12
7.0.180.0200.00616.15
7.0.170.0170.00616.26
7.0.160.0170.00816.14
7.0.150.0160.00816.12
7.0.140.0190.00716.08
7.0.130.0190.00416.19
7.0.120.0160.00916.08
7.0.110.0170.00716.16
7.0.100.0170.00816.10
7.0.90.0160.00916.04
7.0.80.0150.00916.12
7.0.70.0170.00616.12
7.0.60.0180.00416.13
7.0.50.0160.00716.07
7.0.40.0140.01016.02
7.0.30.0170.00716.07
7.0.20.0170.00716.09
7.0.10.0160.00816.12
7.0.00.0340.00616.09
5.6.400.0140.01215.70
5.6.390.0150.01115.90
5.6.380.0160.00815.66
5.6.370.0170.01015.87
5.6.360.0180.00815.85
5.6.350.0170.00715.93
5.6.340.0150.00815.90
5.6.330.0130.01015.85
5.6.320.0180.00715.88
5.6.310.0170.00815.76
5.6.300.0160.00915.72
5.6.290.0130.01015.85
5.6.280.0140.00915.83
5.6.270.0160.00715.88
5.6.260.0210.00615.88
5.6.250.0150.00815.89
5.6.240.0190.00615.97
5.6.230.0130.01015.95
5.6.220.0180.00615.97
5.6.210.0150.00915.91
5.6.200.0190.00616.05
5.6.190.0190.00515.99
5.6.180.0160.00915.92
5.6.170.0160.00915.99
5.6.160.0170.00716.02
5.6.150.0170.00815.98
5.6.140.0190.00816.02
5.6.130.0170.00915.97
5.6.120.0150.00915.92
5.6.110.0160.00915.89
5.6.100.0160.00815.86
5.6.90.0150.00915.86
5.6.80.0150.00715.89
5.6.70.0170.00615.87
5.6.60.0150.00915.94
5.6.50.0180.00615.77
5.6.40.0200.00315.83
5.6.30.0160.00715.82
5.6.20.0160.00815.83
5.6.10.0150.00815.82
5.6.00.0180.00715.80

preferences:
31.31 ms | 403 KiB | 5 Q