3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xor_encrypt($in) { $key = '<censored>'; $text = $in; $outText = ''; // Iterate through each character for($i=0;$i<strlen($text);$i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } // CALLED FIRST function loadData($def) { global $_COOKIE; $mydata = $def; // If data is in the cookie if(array_key_exists("data", $_COOKIE)) { // Get the data in rawform. base64 -> XORED -> json $tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true); // outputs an assoc array with a key "showpassword" and "bgcolor" if(is_array($tempdata) && array_key_exists("showpassword", $tempdata) && array_key_exists("bgcolor", $tempdata)) { // If bg color looks like # + 6 of a-f then copy it over to mydata if (preg_match('/^#(?:[a-fd]{6})$/i', $tempdata['bgcolor'])) { $mydata['showpassword'] = $tempdata['showpassword']; $mydata['bgcolor'] = $tempdata['bgcolor']; } } } return $mydata; } // CALLED NEXT // go the other way function saveData($d) { setcookie("data", base64_encode(xor_encrypt(json_encode($d)))); } function decryptcookie($data){ $base64_decoded = base64_decode($data); $xored = xor_encrypt(base64_decode($data)); $json = json_decode(xor_encrypt(base64_decode($data)), true); $out = json_decode(xor_encrypt(base64_decode($data)), true); //////////////////////////////////////////////////////////////// echo "This is it:\n"; echo "HEXX: ". bin2hex($data)."\n"; echo "orig: ". $data."\n"; echo "base64 decoded: ".$base64_decoded."\n"; echo "xor: ".$xored."\n"; echo "json_decode: ".$json."\n"; echo "out: ". $out."\n\n"; //////////////////////////////////////////////////////////////// print_r($out); print_r(array_values($out)); echo "Type of based64:". gettype($base64_decoded)."\n"; echo "Type of xored:". gettype($xored)."\n"; echo "Type of json:". gettype($json)."\n"; echo "Type of out:". gettype($out); echo "\n****\n"; } ///////////////////////////////////////////// $defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff"); // put the cookie data in the new data $data = loadData($defaultdata); // if the color is a valid hexcode then add it to the cookie if(array_key_exists("bgcolor",$_REQUEST)) { if (preg_match('/^#(?:[a-fd]{6})$/i', $_REQUEST['bgcolor'])) { $data['bgcolor'] = $_REQUEST['bgcolor']; } } saveData($data); $cook = "ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSRwh6QUcIaAw%3D"; $cook_alt = "ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSRwh6QUcIaAw="; decryptcookie($cook_alt); echo 'Hello World!';

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.0090.00618.68
8.3.50.0090.00918.30
8.3.40.0060.01218.79
8.3.30.0000.01518.98
8.3.20.0060.00919.10
8.3.10.0000.00821.72
8.3.00.0090.00019.56
8.2.180.0100.01017.00
8.2.170.0120.00322.96
8.2.160.0040.01119.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00720.56
8.2.120.0060.00326.35
8.2.110.0070.00319.37
8.2.100.0070.00417.91
8.2.90.0080.00017.97
8.2.80.0040.00419.28
8.2.70.0050.00317.63
8.2.60.0030.00517.93
8.2.50.0000.00818.10
8.2.40.0080.00020.66
8.2.30.0000.00819.32
8.2.20.0000.00718.25
8.2.10.0030.00618.19
8.2.00.0040.00418.42
8.1.280.0040.01425.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0070.00322.21
8.1.230.0120.00021.01
8.1.220.0040.00417.79
8.1.210.0030.00618.94
8.1.200.0000.00817.60
8.1.190.0050.00517.47
8.1.180.0000.00818.10
8.1.170.0050.00318.77
8.1.160.0040.00419.00
8.1.150.0000.00720.08
8.1.140.0070.00019.65
8.1.130.0000.00718.95
8.1.120.0040.00417.50
8.1.110.0040.00417.43
8.1.100.0080.00017.55
8.1.90.0000.00817.55
8.1.80.0070.00017.56
8.1.70.0000.00717.59
8.1.60.0030.00517.67
8.1.50.0030.00517.57
8.1.40.0100.00017.50
8.1.30.0040.00417.66
8.1.20.0000.00717.61
8.1.10.0030.00617.64
8.1.00.0000.00717.58
8.0.300.0040.00420.16
8.0.290.0080.00016.88
8.0.280.0030.00318.50
8.0.270.0050.00217.33
8.0.260.0000.00618.95
8.0.250.0000.00817.08
8.0.240.0070.00016.98
8.0.230.0000.00716.96
8.0.220.0000.00817.01
8.0.210.0040.00416.91
8.0.200.0030.00317.07
8.0.190.0090.00017.07
8.0.180.0040.00416.93
8.0.170.0050.00317.09
8.0.160.0040.00417.10
8.0.150.0020.00517.02
8.0.140.0000.00816.83
8.0.130.0000.00713.46
8.0.120.0040.00417.00
8.0.110.0030.00617.08
8.0.100.0030.00617.06
8.0.90.0000.00817.01
8.0.80.0140.00716.95
8.0.70.0000.00816.81
8.0.60.0030.00517.01
8.0.50.0000.00817.07
8.0.30.0130.00617.28
8.0.20.0090.00917.40
8.0.10.0040.00416.96
8.0.00.0100.00816.74
7.4.330.0050.00015.55
7.4.320.0000.00616.66
7.4.300.0030.00316.48
7.4.290.0070.00016.65
7.4.280.0080.00016.50
7.4.270.0050.00216.49
7.4.260.0060.00316.54
7.4.250.0000.00816.63
7.4.240.0000.00816.64
7.4.230.0040.00416.68
7.4.220.0060.01316.48
7.4.210.0090.00616.62
7.4.200.0000.00716.70
7.4.160.0110.00816.79
7.4.150.0120.00717.40
7.4.140.0110.00817.86
7.4.130.0190.00416.70
7.4.120.0120.01216.69
7.4.110.0100.00716.74
7.4.100.0030.01516.65
7.4.90.0100.00716.41
7.4.80.0120.00619.39
7.4.70.0150.00316.42
7.4.60.0090.00916.35
7.4.50.0040.00716.30
7.4.40.0150.00316.61
7.4.30.0130.00416.66
7.4.10.0100.01014.61
7.4.00.0100.00715.01
7.3.330.0000.00613.30
7.3.320.0030.00313.24
7.3.310.0000.00716.48
7.3.300.0040.00416.43
7.3.290.0030.00316.33
7.3.280.0090.00816.42
7.3.270.0160.00317.40
7.3.260.0120.01016.48
7.3.250.0100.01016.45
7.3.240.0130.00816.51
7.3.230.0080.00916.53
7.3.210.0060.01016.52
7.3.200.0120.00616.56
7.3.190.0110.00716.56
7.3.180.0080.00816.53
7.3.170.0080.00816.49
7.3.160.0030.01316.59
7.3.130.0070.01115.06
7.3.120.0090.00915.03
7.3.110.0120.00914.94
7.3.100.0070.00715.01
7.3.90.0040.00614.98
7.3.80.0100.00314.98
7.3.70.0070.00414.77
7.3.60.0030.01214.84
7.3.50.0080.00514.93
7.3.40.0080.00714.94
7.3.30.0080.00814.96
7.3.20.0050.00816.64
7.3.10.0030.00916.75
7.3.00.0050.01116.66
7.2.330.0030.01316.79
7.2.320.0100.01716.61
7.2.310.0090.00616.55
7.2.300.0130.00516.82
7.2.290.0090.00916.80
7.2.260.0110.00715.36
7.2.250.0080.01015.33
7.2.240.0070.01115.09
7.2.230.0070.00915.28
7.2.220.0040.00515.25
7.2.210.0030.00615.03
7.2.200.0070.00615.29
7.2.190.0080.00815.04
7.2.180.0070.00415.20
7.2.170.0030.01215.25
7.2.160.0090.00315.22
7.2.150.0120.00316.99
7.2.140.0060.01116.93
7.2.130.0070.01016.90
7.2.120.0100.01017.00
7.2.110.0030.00916.94
7.2.100.0000.01516.77
7.2.90.0030.01316.93
7.2.80.0030.01017.06
7.2.70.0090.00616.98
7.2.60.0030.01217.00
7.2.50.0050.01116.87
7.2.40.0090.00617.23
7.2.30.0090.00616.77
7.2.20.0000.01416.77
7.2.10.0040.01117.01
7.2.00.0030.01317.02
7.1.330.0050.00915.65
7.1.320.0040.01015.88
7.1.310.0030.01015.87
7.1.300.0070.00615.90
7.1.290.0070.00515.69
7.1.280.0070.00815.85
7.1.270.0060.00815.82
7.1.260.0080.00615.95
7.1.250.0070.00715.90
7.1.240.0100.00715.54
7.1.230.0070.00415.80
7.1.220.0040.00716.01
7.1.210.0100.00715.90
7.1.200.0060.00415.58
7.1.190.0080.00415.88
7.1.180.0120.00315.99
7.1.170.0070.00715.81
7.1.160.0060.00815.74
7.1.150.0090.00915.84
7.1.140.0070.00415.93
7.1.130.0000.00815.93
7.1.120.0030.00615.81
7.1.110.0100.00315.91
7.1.100.0040.00715.79
7.1.90.0000.01415.63
7.1.80.0120.00015.85
7.1.70.0050.00816.46
7.1.60.0070.00516.61
7.1.50.0200.00724.51
7.1.40.0140.01224.31
7.1.30.0230.01024.03
7.1.20.0210.01124.22
7.1.10.0160.00315.26
7.1.00.0100.00715.29
7.0.330.0060.00915.40
7.0.320.0000.01615.28
7.0.310.0000.01215.41
7.0.300.0030.01015.67
7.0.290.0000.01515.59
7.0.280.0030.00615.32
7.0.270.0070.00315.47
7.0.260.0120.00615.39
7.0.250.0090.00615.60
7.0.240.0040.00915.45
7.0.230.0130.00315.39
7.0.220.0070.00715.44
7.0.210.0030.01115.14
7.0.200.0050.00716.20
7.0.190.0140.00315.15
7.0.180.0100.00814.91
7.0.170.0200.01015.04
7.0.160.0190.01014.96
7.0.150.0120.00914.95
7.0.140.0100.01015.05
7.0.130.0070.01014.93
7.0.120.0050.01214.98
7.0.110.0080.00814.97
7.0.100.0120.00715.07
7.0.90.0080.01214.90
7.0.80.0100.00815.03
7.0.70.0140.00315.01
7.0.60.0080.01714.94
7.0.50.0030.01315.01
7.0.40.0080.01013.96
7.0.30.0120.00814.15
7.0.20.0070.01114.12
7.0.10.0100.00614.08
7.0.00.0120.00713.98
5.6.400.0090.00614.56
5.6.390.0060.01314.35
5.6.380.0030.01214.08
5.6.370.0120.00314.66
5.6.360.0070.01014.39
5.6.350.0060.00914.23
5.6.340.0000.01614.20
5.6.330.0090.00614.68
5.6.320.0070.01114.34
5.6.310.0110.00814.41
5.6.300.0060.00914.27
5.6.290.0090.00914.35
5.6.280.0000.01214.35
5.6.270.0070.00414.32
5.6.260.0030.01314.54
5.6.250.0090.00614.27
5.6.240.0040.00814.32
5.6.230.0110.00714.73
5.6.220.0060.00614.23
5.6.210.0030.00714.37
5.6.200.0000.01414.69
5.6.190.0030.01414.27
5.6.180.0030.01314.26
5.6.170.0070.00714.49
5.6.160.0110.00614.36
5.6.150.0060.00914.15
5.6.140.0030.01414.45
5.6.130.0100.00314.63
5.6.120.0060.00914.50
5.6.110.0060.01214.52
5.6.100.0090.00614.20
5.6.90.0100.00414.13
5.6.80.0040.01014.38
5.6.70.0040.00714.18
5.6.60.0050.00514.58
5.6.50.0070.00713.96
5.6.40.0060.00314.22
5.6.30.0070.00714.11
5.6.20.0030.00714.48
5.6.10.0100.00314.39
5.6.00.0070.00714.27

preferences:
56.79 ms | 401 KiB | 5 Q