3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["\r\n \r\n 300518<\/departureDate>\r\n\t\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t\t \r\n <\/availabilityDetails>\r\n \r\n HYD<\/cityAirport>\r\n <\/departureLocationInfo>\r\n \r\n DXB<\/cityAirport>\r\n <\/arrivalLocationInfo>\r\n <\/availabilityProductInfo>702<\/orderClassesByCabin><\/cabinOption>",44,"AUHOT3116"]; //should yield $desired_output = "300518-departuredate-availabilityDetails-HYD-cityAirport-departureLocationInfo-DXB-cityAirport-arrivalLocationInfo-availabilityProductInfo-702-orderClassesByCabin-44-AUHOT3116"; $trim = ["\t","\r","\n","<\/",">"," ","cabinOption"]; foreach($array as &$value) { $value = str_replace($trim,"-",$value); $value = preg_replace('/[- ]{2,}/','-',$value); $value = trim($value,"- "); } $replaced_output = implode("-",$array); var_dump($desired_output,$replaced_output);

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.0040.01218.68
8.3.50.0070.01018.57
8.3.40.0040.01118.88
8.3.30.0060.01518.97
8.3.20.0050.00319.02
8.3.10.0150.00323.66
8.3.00.0040.00421.00
8.2.180.0120.00616.88
8.2.170.0140.00022.96
8.2.160.0080.00622.20
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0080.00018.09
8.2.120.0040.00426.35
8.2.110.0070.00419.39
8.2.100.0060.00618.03
8.2.90.0060.00617.75
8.2.80.0050.00319.78
8.2.70.0000.00818.04
8.2.60.0040.00418.22
8.2.50.0040.00418.10
8.2.40.0040.00421.16
8.2.30.0000.00719.20
8.2.20.0040.00418.07
8.2.10.0040.00418.16
8.2.00.0040.00418.20
8.1.280.0030.01725.92
8.1.270.0040.00423.99
8.1.260.0090.00026.35
8.1.250.0100.00728.09
8.1.240.0030.00721.19
8.1.230.0040.00720.31
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.47
8.1.190.0050.00317.48
8.1.180.0060.00318.10
8.1.170.0040.00418.71
8.1.160.0000.00719.04
8.1.150.0020.00518.98
8.1.140.0000.00722.18
8.1.130.0020.00520.17
8.1.120.0060.00317.52
8.1.110.0000.00817.47
8.1.100.0060.00317.61
8.1.90.0000.00717.59
8.1.80.0000.00817.51
8.1.70.0070.00017.57
8.1.60.0040.00417.63
8.1.50.0040.00417.66
8.1.40.0040.00417.66
8.1.30.0070.00317.70
8.1.20.0060.00317.81
8.1.10.0050.00317.61
8.1.00.0080.00017.55
8.0.300.0100.00019.80
8.0.290.0060.00316.75
8.0.280.0000.00718.47
8.0.270.0040.00417.14
8.0.260.0040.00418.47
8.0.250.0050.00217.08
8.0.240.0000.00717.08
8.0.230.0030.00317.11
8.0.220.0080.00017.14
8.0.210.0070.00017.11
8.0.200.0030.00317.00
8.0.190.0000.00817.11
8.0.180.0030.00617.07
8.0.170.0000.00916.95
8.0.160.0040.00417.05
8.0.150.0050.00316.96
8.0.140.0040.00416.98
8.0.130.0000.00613.43
8.0.120.0070.00017.07
8.0.110.0040.00416.95
8.0.100.0040.00417.07
8.0.90.0080.00017.02
8.0.80.0150.00517.14
8.0.70.0000.00716.99
8.0.60.0050.00217.17
8.0.50.0090.00017.08
8.0.30.0060.01117.21
8.0.20.0130.00517.40
8.0.10.0040.00417.13
8.0.00.0110.01016.95
7.4.330.0030.00315.55
7.4.320.0060.00016.71
7.4.300.0040.00416.85
7.4.290.0000.00716.69
7.4.280.0000.00716.71
7.4.270.0000.00716.83
7.4.260.0050.00316.68
7.4.250.0040.00416.69
7.4.240.0000.00816.86
7.4.230.0040.00416.68
7.4.220.0090.00016.91
7.4.210.0070.01016.77
7.4.200.0040.00416.83
7.4.160.0080.01016.75
7.4.140.0140.00717.86
7.4.130.0070.01116.63
7.4.120.0100.01016.59
7.4.110.0150.00416.72
7.4.100.0090.00816.82
7.4.90.0120.00616.92
7.4.80.0150.00919.39
7.4.70.0070.01116.51
7.4.60.0090.00916.66
7.4.50.0100.00716.68
7.4.40.0120.00916.71
7.4.00.0000.01515.15
7.3.330.0030.00313.30
7.3.320.0000.00613.15
7.3.310.0070.00016.50
7.3.300.0000.00716.32
7.3.290.0070.00016.28
7.3.280.0120.00316.31
7.3.260.0080.01116.56
7.3.240.0100.00816.52
7.3.230.0070.01016.50
7.3.210.0080.00816.31
7.3.200.0140.00816.89
7.3.190.0070.01416.80
7.3.180.0140.00516.35
7.3.170.0060.01616.61
7.3.160.0120.00816.81
7.2.330.0180.00616.91
7.2.320.0110.00716.54
7.2.310.0090.00916.73
7.2.300.0060.01216.82
7.2.290.0080.00816.86
7.2.120.0280.00014.92
7.2.110.0310.00914.90
7.2.100.0280.00614.97
7.2.90.0300.00614.82
7.2.80.0300.01114.84
7.2.70.0230.00315.16
7.2.60.0160.01315.20
7.2.50.0280.00415.39
7.2.40.0420.00315.31
7.2.30.0240.00315.25
7.2.20.0190.01015.36
7.2.10.0260.00714.96
7.2.00.0320.00315.26
7.1.240.0180.01214.26
7.1.230.0560.00613.91
7.1.220.0220.00913.76
7.1.210.0210.01413.67
7.1.200.0180.00914.05
7.1.190.0270.00714.16
7.1.180.0320.01013.86
7.1.170.0210.00413.98
7.1.160.0240.00713.79
7.1.150.0230.00513.79
7.1.140.0200.00714.09
7.1.130.0240.00714.10
7.1.120.0210.00613.79
7.1.110.0340.00614.01
7.1.100.0230.01713.91
7.1.90.0190.00614.14
7.1.80.0210.00714.07
7.1.70.0270.00314.11
7.1.60.0280.00314.23
7.1.50.0200.01014.14
7.1.40.0260.00414.08
7.1.30.0250.00614.06
7.1.20.0200.00814.02
7.1.10.0110.01114.21
7.1.00.0170.01014.10
5.6.380.0070.01014.65

preferences:
48.01 ms | 400 KiB | 5 Q