3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ['user_firstname' => 'Jack', 'user_lastname' => 'Smith', 'user_address_1' => '123']; $data = []; foreach($array1 as $key=>$value){ $tokens = explode('_', $key, 2); // split the string in an array of strings, using _ as a delimitor. // the 2 is the maximun number of tokens to split the string into, look at explode() docs $keyName = end($tokens); // use last element of the array $data[$keyName] = $value; // assign value to key } print_r($data);

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.0160.00318.43
8.3.50.0130.00718.02
8.3.40.0090.00618.55
8.3.30.0100.00618.72
8.3.20.0080.00018.98
8.3.10.0050.00323.66
8.3.00.0050.00320.62
8.2.180.0110.00718.29
8.2.170.0060.00922.96
8.2.160.0130.00322.13
8.2.150.0040.00424.18
8.2.140.0090.00624.66
8.2.130.0080.00318.09
8.2.120.0070.00026.35
8.2.110.0100.00021.00
8.2.100.0040.00817.68
8.2.90.0000.00819.25
8.2.80.0050.00317.97
8.2.70.0040.00417.93
8.2.60.0000.00718.34
8.2.50.0080.00018.10
8.2.40.0040.00421.25
8.2.30.0040.00719.19
8.2.20.0040.00418.00
8.2.10.0000.00718.18
8.2.00.0040.00418.09
8.1.280.0160.00025.92
8.1.270.0060.00323.92
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00022.61
8.1.230.0080.00420.75
8.1.220.0040.00417.76
8.1.210.0000.00818.90
8.1.200.0080.00017.35
8.1.190.0050.00317.23
8.1.180.0050.00318.10
8.1.170.0000.00818.59
8.1.160.0000.00718.88
8.1.150.0070.00018.79
8.1.140.0070.00022.17
8.1.130.0000.00720.13
8.1.120.0030.00717.38
8.1.110.0040.00417.41
8.1.100.0040.00417.35
8.1.90.0000.00717.46
8.1.80.0040.00417.48
8.1.70.0000.00917.47
8.1.60.0040.00417.63
8.1.50.0000.00817.44
8.1.40.0040.00417.50
8.1.30.0050.00317.57
8.1.20.0070.00417.66
8.1.10.0040.00417.62
8.1.00.0030.00617.38
8.0.300.0040.00419.98
8.0.290.0050.00316.75
8.0.280.0070.00018.44
8.0.270.0070.00017.27
8.0.260.0030.00318.44
8.0.250.0000.00716.95
8.0.240.0030.00316.95
8.0.230.0000.00716.97
8.0.220.0050.00316.84
8.0.210.0030.00316.85
8.0.200.0060.00016.99
8.0.190.0040.00416.95
8.0.180.0030.00516.90
8.0.170.0030.00616.82
8.0.160.0070.00016.79
8.0.150.0040.00416.75
8.0.140.0040.00416.87
8.0.130.0030.00313.35
8.0.120.0040.00416.89
8.0.110.0000.00816.73
8.0.100.0000.00816.74
8.0.90.0040.00416.72
8.0.80.0050.01116.86
8.0.70.0050.00316.79
8.0.60.0050.00216.67
8.0.50.0000.00816.75
8.0.30.0120.00717.08
8.0.20.0100.00917.40
8.0.10.0040.00416.90
8.0.00.0060.01216.92
7.4.330.0020.00215.55
7.4.320.0060.00016.52
7.4.300.0030.00316.51
7.4.290.0000.00716.39
7.4.280.0030.00516.41
7.4.270.0030.00616.50
7.4.260.0000.00716.43
7.4.250.0040.00416.32
7.4.240.0000.00716.58
7.4.230.0000.00716.62
7.4.220.0000.00716.62
7.4.210.0030.01216.62
7.4.200.0000.00716.50
7.4.160.0110.00516.44
7.4.140.0080.01117.86
7.4.130.0140.00316.52
7.4.120.0110.00716.55
7.4.110.0090.01416.56
7.4.100.0110.00616.72
7.4.90.0080.00916.55
7.4.80.0070.01519.39
7.4.70.0070.01016.36
7.4.60.0040.01216.40
7.4.50.0070.00716.63
7.4.40.0030.01516.61
7.4.00.0090.00814.86
7.3.330.0000.00513.09
7.3.320.0000.00513.26
7.3.310.0060.00016.27
7.3.300.0070.00016.18
7.3.290.0030.00316.32
7.3.280.0040.01116.32
7.3.260.0090.00916.37
7.3.240.0080.01016.33
7.3.230.0090.00916.45
7.3.210.0090.00916.43
7.3.200.0100.01016.40
7.3.190.0090.00916.42
7.3.180.0130.00816.50
7.3.170.0040.01416.58
7.3.160.0060.01216.36
7.3.120.0140.00414.88
7.3.110.0110.00014.95
7.3.100.0030.01314.95
7.3.90.0060.00614.85
7.3.80.0040.01115.13
7.3.70.0000.00914.72
7.3.60.0070.01014.79
7.3.50.0000.01614.98
7.3.40.0060.00314.86
7.3.30.0030.01014.59
7.3.20.0100.00716.85
7.3.10.0040.00916.49
7.3.00.0020.01116.47
7.2.330.0030.01416.45
7.2.320.0030.01316.73
7.2.310.0070.01716.55
7.2.300.0080.00816.57
7.2.290.0000.02216.46
7.2.250.0030.01715.19
7.2.240.0140.00715.20
7.2.230.0060.01215.24
7.2.220.0090.00314.93
7.2.210.0060.00915.15
7.2.200.0040.00815.17
7.2.190.0000.01515.20
7.2.180.0030.00914.95
7.2.170.0030.01215.08
7.2.130.0040.00716.72
7.2.120.0160.00816.14
7.2.110.0130.00916.06
7.2.100.0150.00716.16
7.2.90.0160.00816.23
7.2.80.0180.00616.20
7.2.70.0220.00616.43
7.2.60.0180.00716.35
7.2.50.0170.00516.31
7.2.40.0140.00816.34
7.2.30.0130.00816.36
7.2.20.0150.00816.43
7.2.10.0140.00816.35
7.2.00.0130.00916.40
7.1.330.0070.00415.93
7.1.320.0000.00815.90
7.1.310.0060.00315.76
7.1.300.0060.00915.83
7.1.290.0100.00315.88
7.1.280.0100.00315.88
7.1.270.0030.01015.87
7.1.260.0060.00615.99
7.1.250.0030.00715.83
7.1.240.0320.00414.66
7.1.230.0170.00615.22
7.1.220.0130.00815.26
7.1.210.0160.00515.11
7.1.200.0190.00415.19
7.1.190.0170.00415.17
7.1.180.0120.00615.18
7.1.170.0140.00615.30
7.1.160.0370.00815.22
7.1.150.0130.00715.08
7.1.140.0150.00715.30
7.1.130.0180.00715.23
7.1.120.0160.01015.35
7.1.110.0210.00515.32
7.1.100.0180.00815.24
7.1.90.0150.00415.46
7.1.80.0150.00515.35
7.1.70.0220.00615.28
7.1.60.0200.00415.34
7.1.50.0190.00815.30
7.1.40.0200.00715.11
7.1.30.0160.00615.23
7.1.20.0140.01115.24
7.1.10.0190.00815.27
7.1.00.0220.00415.26
7.0.330.0040.00815.13
5.6.380.0060.00914.36

preferences:
57.13 ms | 401 KiB | 5 Q