3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array( 'gid'=>1, 'phone_number'=>1, 'weibo'=>1, 'qq'=>1, 'email'=>1, 'gender'=>1, 'age'=>1, 'area'=>1, 'computer'=>1, 'phone'=>1, 'valid_user'=>1, 'bank'=>json_encode(array(1,2,3)), 'tag_big'=>json_encode(array(1,2,3)), 'tag_medium'=>json_encode(array(1,2,3)), 'tag_small'=>json_encode(array(1,2,3)), 'family'=>json_encode(array(1,2,3)), 'friend'=>json_encode(array(1,2,3)), 'visitor'=>json_encode(array(1,2,3)) ); $field = array( 'gid', 'phone_number', 'weibo', 'qq', 'email', 'gender', 'age', 'area', 'computer', 'phone', 'valid_user', 'bank', 'tag_big', 'tag_medium', 'tag_small', 'family', 'friend', 'visitor' ); function constructPortrait(ValueAddedParams $params){ $retPortraitArr = array(); $portraitArr = json_decode($params->getUserPortraitInfo(), true); $fields = ValueAdded::$FIELDS; foreach($portraitArr as $key => $portrait){ foreach($fields as $field){ $retPortraitArr[$key][$field] = isset($portrait[$key]) && !empty($portrait[$key]) ? $portrait[$key] : ''; } } return $retPortraitArr; } echo json_encode(constructPortrait($field, $test));

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.40.0120.00318.89
8.3.30.0170.00318.70
8.3.20.0000.00720.34
8.3.10.0040.00420.48
8.3.00.0040.00421.73
8.2.170.0090.00922.96
8.2.160.0100.01022.26
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00020.87
8.2.120.0040.00426.35
8.2.110.0090.00019.27
8.2.100.0110.00018.04
8.2.90.0050.00319.13
8.2.80.0040.00717.97
8.2.70.0090.00017.63
8.2.60.0060.00317.80
8.2.50.0040.00818.09
8.2.40.0000.00922.19
8.2.30.0000.00819.36
8.2.20.0040.00417.71
8.2.10.0050.00218.13
8.2.00.0080.00018.08
8.1.270.0060.00323.99
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0030.00622.56
8.1.230.0040.00817.83
8.1.220.0080.00017.74
8.1.210.0050.00318.77
8.1.200.0090.00017.23
8.1.190.0050.00317.22
8.1.180.0000.00818.10
8.1.170.0090.00018.48
8.1.160.0050.00220.71
8.1.150.0000.00718.76
8.1.140.0000.00819.54
8.1.130.0080.00017.68
8.1.120.0000.00717.33
8.1.110.0000.00817.42
8.1.100.0040.00417.31
8.1.90.0000.00717.44
8.1.80.0070.00017.41
8.1.70.0030.00317.43
8.1.60.0040.00417.51
8.1.50.0050.00317.57
8.1.40.0040.00417.53
8.1.30.0050.00317.74
8.1.20.0030.00617.49
8.1.10.0040.00417.65
8.1.00.0070.00317.61
8.0.300.0000.00818.77
8.0.290.0060.00316.75
8.0.280.0030.00318.30
8.0.270.0070.00017.11
8.0.260.0070.00017.13
8.0.250.0040.00217.00
8.0.240.0000.00717.05
8.0.230.0050.00317.00
8.0.220.0030.00316.81
8.0.210.0030.00316.89
8.0.200.0060.00316.87
8.0.190.0050.00316.97
8.0.180.0080.00016.92
8.0.170.0080.00216.84
8.0.160.0000.00916.86
8.0.150.0000.00816.93
8.0.140.0000.00716.87
8.0.130.0030.00313.30
8.0.120.0000.00816.82
8.0.110.0050.00216.82
8.0.100.0000.00716.92
8.0.90.0050.00216.91
8.0.80.0080.01516.91
8.0.70.0020.00516.71
8.0.60.0000.00816.71
8.0.50.0000.00716.74
8.0.30.0140.00317.13
8.0.20.0120.01017.40
8.0.10.0000.00817.07
8.0.00.0130.00516.80
7.4.330.0020.00216.67
7.4.320.0060.00016.46
7.4.300.0000.00616.63
7.4.290.0000.00716.54
7.4.280.0030.00516.47
7.4.270.0080.00016.59
7.4.260.0080.00016.41
7.4.250.0080.00016.50
7.4.240.0000.00716.44
7.4.230.0030.00316.47
7.4.220.0090.00916.48
7.4.210.0090.00616.49
7.4.200.0030.00316.44
7.4.160.0000.01516.59
7.4.150.0080.01117.40
7.4.140.0120.01217.86
7.4.130.0120.00716.66
7.4.120.0120.00716.54
7.4.110.0100.01016.54
7.4.100.0090.01516.54
7.4.90.0070.01016.50
7.4.80.0120.00619.39
7.4.70.0070.01016.60
7.4.60.0030.01316.62
7.4.50.0030.01016.45
7.4.40.0060.01316.45
7.4.30.0140.00316.43
7.4.00.0030.00914.99
7.3.330.0060.00013.25
7.3.320.0060.00013.18
7.3.310.0030.00316.19
7.3.300.0070.00016.32
7.3.290.0120.00616.30
7.3.280.0070.01116.36
7.3.270.0120.00617.40
7.3.260.0070.01016.38
7.3.250.0140.00616.41
7.3.240.0120.00516.57
7.3.230.0150.00716.39
7.3.210.0110.01116.47
7.3.200.0130.01016.35
7.3.190.0150.00316.34
7.3.180.0110.01616.62
7.3.170.0060.00916.40
7.3.160.0090.01216.52
7.3.120.0030.01615.06
7.3.110.0070.01114.92
7.3.100.0070.00715.06
7.3.90.0040.00814.81
7.3.80.0060.01215.03
7.3.70.0030.00614.60
7.3.60.0060.00914.79
7.3.50.0030.01414.88
7.3.40.0000.01014.91
7.3.30.0000.01414.97
7.3.20.0060.00316.60
7.3.10.0030.00616.47
7.3.00.0030.01016.39
7.2.330.0140.00616.79
7.2.320.0060.01416.61
7.2.310.0060.01016.73
7.2.300.0140.00716.55
7.2.290.0080.00816.71
7.2.250.0090.00614.97
7.2.240.0100.00714.67
7.2.230.0120.00615.07
7.2.220.0040.00814.92
7.2.210.0000.01614.99
7.2.200.0000.01214.93
7.2.190.0000.00915.09
7.2.180.0060.00314.95
7.2.170.0030.00914.75
7.2.60.0060.00916.73
7.2.00.0120.00419.06
7.1.330.0030.01015.74
7.1.320.0000.01215.81
7.1.310.0030.00715.81
7.1.300.0000.01215.80
7.1.290.0030.00615.77
7.1.280.0040.01115.83
7.1.270.0080.00815.74
7.1.260.0040.01115.77
7.1.200.0030.00615.40
7.1.100.0040.00818.14
7.1.70.0050.00317.19
7.1.60.0070.01719.19
7.1.50.0070.01417.05
7.1.00.0030.07722.27
7.0.200.1150.01014.84
7.0.90.0530.08320.07
7.0.80.0470.08320.06
7.0.70.0330.03719.97
7.0.60.0400.03319.85
7.0.50.0600.08020.29
7.0.40.0130.07720.17
7.0.30.0000.08320.12
7.0.20.0100.07720.11
7.0.10.0100.06020.04
7.0.00.0130.07020.12
5.6.280.0000.03321.12
5.6.230.0070.04020.54
5.6.220.0070.03320.63
5.6.210.0030.03720.59
5.6.200.0130.07721.04
5.6.190.0100.07721.00
5.6.180.0030.08021.05
5.6.170.0130.08021.09
5.6.160.0130.07721.15
5.6.150.0100.05720.95
5.6.140.0070.08021.01
5.6.130.0100.08721.01
5.6.120.0100.07721.14
5.6.110.0100.08321.04
5.6.100.0000.05020.95
5.6.90.0130.08321.12
5.6.80.0100.04020.51
5.6.70.0170.05720.37
5.6.60.0100.07020.49
5.6.50.0130.06320.36
5.6.40.0130.07020.32
5.6.30.0070.08720.43
5.6.20.0100.07320.43
5.6.10.0170.07020.47
5.6.00.0030.05020.30
5.5.370.0130.05720.60
5.5.360.0070.03020.57
5.5.350.0000.03720.48
5.5.340.0200.07320.88
5.5.330.0070.08720.81
5.5.320.0030.08320.76
5.5.310.0070.05320.88
5.5.300.0100.08020.91
5.5.290.0070.08320.92
5.5.280.0100.08720.94
5.5.270.0170.07020.89
5.5.260.0130.07320.90
5.5.250.0030.08320.68
5.5.240.0130.04320.32
5.5.230.0030.08320.31
5.5.220.0070.06320.27
5.5.210.0100.07720.31
5.5.200.0200.06320.29
5.5.190.0200.06020.28
5.5.180.0070.07720.26
5.5.160.0100.07320.00
5.5.150.0000.07720.28
5.5.140.0100.07320.14
5.5.130.0030.08320.28
5.5.120.0130.05720.23
5.5.110.0100.07320.18
5.5.100.0030.06020.17
5.5.90.0000.08020.03
5.5.80.0070.08020.02
5.5.70.0100.07720.14
5.5.60.0200.04320.14
5.5.50.0100.06720.04
5.5.40.0100.07720.17
5.5.30.0100.06719.94
5.5.20.0070.04720.06
5.5.10.0030.05020.09
5.5.00.0100.07020.00

preferences:
46.72 ms | 400 KiB | 5 Q