3v4l.org

run code in 300+ PHP versions simultaneously
<?php function searchByVINs ($VINs,$fields) { /* // test multi-VIN batching via textarea at bottom of https://vpic.nhtsa.dot.gov/api/ $stream_options_content = http_build_query(["data" => implode(";", $VINS), "format" => "JSON"]); $stream_options = [ 'http' => [ 'header' => "Content-Type: application/x-www-form-urlencoded\r\n". "Content-Length: ".strlen($postdata)."\r\n", 'method' => "POST", 'content' => $postdata ] ]; $context = stream_context_create($stream_options); $apiURL = "https://vpic.nhtsa.dot.gov/api/vehicles/DecodeVINValuesBatch/"; if (!$fp = @fopen($apiURL, "rb", FALSE, $context)) { return ["success" => false, "response" => "Unable to open stream"]; } if (!$response = stream_get_contents($fp),true)) { return ["success" => false, "response" => "Unable to receive streamed data"]; } */ $response = '{"Count":2,"Message":"Results returned successfully","SearchCriteria":"","Results":[{"ABS":"","AEB":"","AdaptiveCruiseControl":"","AdaptiveHeadlights":"","AdditionalErrorText":"","AirBagLocCurtain":"","AirBagLocFront":"","AirBagLocKnee":"","AirBagLocSeatCushion":"","AirBagLocSide":"","Artemis":"","AxleConfiguration":"","Axles":"","BasePrice":"","BatteryA":"","BatteryA_to":"","BatteryCells":"","BatteryInfo":"","BatteryKWh":"","BatteryKWh_to":"","BatteryModules":"","BatteryPacks":"","BatteryType":"","BatteryV":"","BatteryV_to":"","BedLengthIN":"","BedType":"","BlindSpotMon":"","BodyCabType":"","BodyClass":"Wagon","BrakeSystemDesc":"","BrakeSystemType":"Hydraulic","BusFloorConfigType":"","BusLength":"","BusType":"","CAFEBodyType":"","CAFEMake":"","CAFEModel":"","CashForClunkers":"","ChargerLevel":"","ChargerPowerKW":"","CoolingType":"","Country":"","CurbWeightLB":"","CustomMotorcycleType":"","DestinationMarket":"","DisplacementCC":"2200.0","DisplacementCI":"134.25223700841","DisplacementL":"2.2","Doors":"4","DriveType":"","DriverAssist":"","ESC":"","EVDriveUnit":"","ElectrificationLevel":"","EngineConfiguration":"","EngineCycles":"","EngineCylinders":"4","EngineHP":"","EngineHP_to":"","EngineKW":"","EngineManufacturer":"GM","EngineModel":"L61\/LBZ","EntertainmentSystem":"","EquipmentType":"","ErrorCode":"1 - VIN decoded clean. Check Digit (9th position) does not calculate properly.","ForwardCollisionWarning":"","FuelInjectionType":"Multipoint Fuel Injection (MPFI)","FuelTypePrimary":"Gasoline","FuelTypeSecondary":"","GVWR":"Class 1D: 5,001 - 6,000 lb (2,268 - 2,722 kg)","LaneDepartureWarning":"","LaneKeepSystem":"","Make":"CHEVROLET","Manufacturer":"GENERAL MOTORS LLC","ManufacturerId":"984","ManufacturerType":"","Model":"HHR","ModelYear":"2006","MotorcycleChassisType":"","MotorcycleSuspensionType":"","NCAPBodyType":"","NCAPMake":"","NCAPModel":"","NCICCode":"","NCSABodyType":"","NCSAMake":"","NCSAModel":"","Note":"","OtherBusInfo":"","OtherEngineInfo":"L61: 2.2L, 4Cyl, Aluminium, DOHC MFI\u000d\u000aLBZ: 6.6L, V8, DI, Turbo Diesel, inc HP","OtherMotorcycleInfo":"","OtherRestraintSystemInfo":"","OtherTrailerInfo":"","ParkAssist":"","PlantCity":"Ramos Arizpe","PlantCompanyName":"GMNA","PlantCountry":"Mexico","PlantState":"","PossibleValues":"","Pretensioner":"","RearVisibilityCamera":"","SeatBeltsAll":"","SeatRows":"","Seats":"","Series":"LS","Series2":"","SteeringLocation":"","SuggestedVIN":"","TPMS":"","TopSpeedMPH":"","TrackWidth":"","TractionControl":"","TrailerBodyType":"","TrailerLength":"","TrailerType":"","TransmissionSpeeds":"","TransmissionStyle":"","Trim":"1\/2 Ton","Trim2":"","Turbo":"","VIN":"3GNDA13D76S000000","ValveTrainDesign":"Dual Overhead Cam (DOHC)","VehicleType":"MULTIPURPOSE PASSENGER VEHICLE (MPV)","WheelBaseLong":"","WheelBaseShort":"","WheelBaseType":"","WheelSizeFront":"","WheelSizeRear":"","Wheels":"","Windows":""},{"ABS":"","AEB":"","AdaptiveCruiseControl":"","AdaptiveHeadlights":"","AdditionalErrorText":"","AirBagLocCurtain":"1st & 2nd Rows","AirBagLocFront":"1st Row (Driver & Passenger)","AirBagLocKnee":"","AirBagLocSeatCushion":"","AirBagLocSide":"1st Row (Driver & Passenger)","Artemis":"","AxleConfiguration":"","Axles":"","BasePrice":"","BatteryA":"","BatteryA_to":"","BatteryCells":"","BatteryInfo":"","BatteryKWh":"","BatteryKWh_to":"","BatteryModules":"","BatteryPacks":"","BatteryType":"","BatteryV":"","BatteryV_to":"","BedLengthIN":"","BedType":"","BlindSpotMon":"","BodyCabType":"","BodyClass":"Wagon","BrakeSystemDesc":"","BrakeSystemType":"","BusFloorConfigType":"","BusLength":"","BusType":"","CAFEBodyType":"","CAFEMake":"","CAFEModel":"","CashForClunkers":"","ChargerLevel":"","ChargerPowerKW":"","CoolingType":"","Country":"","CurbWeightLB":"","CustomMotorcycleType":"","DestinationMarket":"","DisplacementCC":"2400.0","DisplacementCI":"146.45698582735","DisplacementL":"2.4","Doors":"","DriveType":"4x2","DriverAssist":"","ESC":"","EVDriveUnit":"","ElectrificationLevel":"","EngineConfiguration":"","EngineCycles":"","EngineCylinders":"","EngineHP":"","EngineHP_to":"","EngineKW":"","EngineManufacturer":"","EngineModel":"DOHC MPI THETA-II","EntertainmentSystem":"","EquipmentType":"","ErrorCode":"1 - VIN decoded clean. Check Digit (9th position) does not calculate properly.","ForwardCollisionWarning":"","FuelInjectionType":"Multipoint Fuel Injection (MPFI)","FuelTypePrimary":"Gasoline","FuelTypeSecondary":"","GVWR":"Class 1C: 4,001 - 5,000 lb (1,814 - 2,268 kg)","LaneDepartureWarning":"","LaneKeepSystem":"","Make":"KIA","Manufacturer":"HYUNDAI-KIA AMERICA TECHNICAL CENTER INC (HATCI)","ManufacturerId":"1034","ManufacturerType":"","Model":"Sorento","ModelYear":"2012","MotorcycleChassisType":"","MotorcycleSuspensionType":"","NCAPBodyType":"","NCAPMake":"","NCAPModel":"","NCICCode":"","NCSABodyType":"","NCSAMake":"","NCSAModel":"","Note":"","OtherBusInfo":"","OtherEngineInfo":"","OtherMotorcycleInfo":"","OtherRestraintSystemInfo":"","OtherTrailerInfo":"","ParkAssist":"","PlantCity":"","PlantCompanyName":"Kia Motor Manufacturing, Georgia","PlantCountry":"United States (USA)","PlantState":"Georgia","PossibleValues":"","Pretensioner":"","RearVisibilityCamera":"","SeatBeltsAll":"Manual","SeatRows":"","Seats":"","Series":"GL(Middle-low grade)","Series2":"","SteeringLocation":"","SuggestedVIN":"","TPMS":"Direct","TopSpeedMPH":"","TrackWidth":"","TractionControl":"","TrailerBodyType":"","TrailerLength":"","TrailerType":"","TransmissionSpeeds":"","TransmissionStyle":"","Trim":"","Trim2":"","Turbo":"","VIN":"5XYKT3A12CG000000","ValveTrainDesign":"Dual Overhead Cam (DOHC)","VehicleType":"MULTIPURPOSE PASSENGER VEHICLE (MPV)","WheelBaseLong":"","WheelBaseShort":"","WheelBaseType":"","WheelSizeFront":"","WheelSizeRear":"","Wheels":"","Windows":""}]}'; if(($data = @json_decode($response,true)) === null && json_last_error()!==JSON_ERROR_NONE){ return ["success" => false, "response" => "Unable to parse streamed data"]; } if (!isset($data["Message"]) || $data["Message"] != "Results returned successfully") { return ["success" => false, "response" => "Received unsuccessful dataset"]; } $return = []; $keys = array_flip($fields); foreach ($data["Results"] as $dataset) { $isolated = array_intersect_key($dataset,$keys); // only retain the elements with keys that match $fields values $sorted = array_replace($keys,$isolated); // order the dataset by order of elements in $fields $return[] = $sorted; } return ["success" => true, "response" => $return]; } $VINs = ["3GNDA13D76S000000", "5XYKT3A12CG000000"]; $fields = ["VIN", "ModelYear", "Make", "FuelTypePrimary", "DriveType", "BodyClass"]; $response = searchByVINs($VINs,$fields); if (!$response["success"]) { echo "Oops, the api call failed. {$response["response"]}"; } else { foreach ($response["response"] as $item){ echo "<div>\n"; foreach ($item as $key => $value) { echo "\t<div>$key: $value</div>\n"; } echo "</div>\n"; } }

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.120.0130.00720.50
8.4.110.0150.00722.38
8.4.100.0090.01318.63
8.4.90.0130.00718.76
8.4.80.0100.01018.87
8.4.70.0090.00318.86
8.4.60.0050.00420.48
8.4.50.0060.00318.74
8.4.40.0150.00417.83
8.4.30.0100.01019.64
8.4.20.0040.01819.43
8.4.10.0070.00417.54
8.3.250.0130.00618.88
8.3.240.0090.01021.12
8.3.230.0140.00416.77
8.3.220.0100.00920.89
8.3.210.0100.00616.76
8.3.200.0050.00316.55
8.3.190.0080.00316.89
8.3.180.0140.00618.93
8.3.170.0100.01016.85
8.3.160.0080.00017.43
8.3.150.0130.00318.95
8.3.140.0060.00319.13
8.3.130.0030.00618.46
8.3.120.0030.00620.77
8.3.110.0040.00720.94
8.3.100.0080.00024.06
8.3.90.0070.00726.77
8.3.80.0030.00618.55
8.3.70.0140.00316.75
8.3.60.0070.01118.46
8.3.50.0070.01018.34
8.3.40.0100.01018.88
8.3.30.0120.00318.84
8.3.20.0080.00021.85
8.3.10.0000.00823.71
8.3.00.0080.00023.66
8.2.290.0120.00720.42
8.2.280.0130.00718.42
8.2.270.0070.01118.71
8.2.260.0040.01116.69
8.2.250.0130.00916.62
8.2.240.0060.00319.20
8.2.230.0040.01222.58
8.2.220.0070.00337.54
8.2.210.0090.00626.77
8.2.200.0030.01016.50
8.2.190.0040.01216.58
8.2.180.0080.00816.63
8.2.170.0110.00422.96
8.2.160.0140.00020.44
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0030.00620.89
8.2.120.0050.00226.35
8.2.110.0070.00321.04
8.2.100.0090.00318.03
8.2.90.0050.00318.03
8.2.80.0000.00818.09
8.2.70.0040.00417.63
8.2.60.0060.00317.63
8.2.50.0040.00417.50
8.2.40.0050.00518.05
8.2.30.0040.00418.08
8.2.20.0070.00018.22
8.2.10.0000.00818.04
8.2.00.0000.00818.04
8.1.330.0110.00922.23
8.1.320.0100.01016.08
8.1.310.0070.00716.69
8.1.300.0040.01218.38
8.1.290.0090.00018.88
8.1.280.0090.00625.92
8.1.270.0050.00323.91
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00323.97
8.1.230.0090.00320.97
8.1.220.0030.00517.79
8.1.210.0000.00818.77
8.1.200.0050.00517.35
8.1.190.0040.00717.23
8.1.180.0040.00418.10
8.1.170.0000.00917.62
8.1.160.0050.00318.85
8.1.150.0000.00820.21
8.1.140.0110.00017.75
8.1.130.0030.00717.57
8.1.120.0040.00417.56
8.1.110.0030.00517.52
8.1.100.0040.00417.41
8.1.90.0040.00417.50
8.1.80.0000.00817.40
8.1.70.0000.00717.50
8.1.60.0040.00817.58
8.1.50.0030.00717.55
8.1.40.0000.00817.56
8.1.30.0030.00617.66
8.1.20.0040.00417.61
8.1.10.0000.00817.67
8.1.00.0040.00417.55
8.0.300.0050.00220.02
8.0.290.0000.00816.88
8.0.280.0070.00018.43
8.0.270.0000.00717.30
8.0.260.0070.00016.86
8.0.250.0030.00317.02
8.0.240.0070.00416.96
8.0.230.0060.00316.95
8.0.220.0000.00716.91
8.0.210.0000.00716.95
8.0.200.0040.00416.97
8.0.190.0000.01016.96
8.0.180.0030.00616.97
8.0.170.0060.00316.93
8.0.160.0040.00416.99
8.0.150.0070.00016.88
8.0.140.0000.00716.87
8.0.130.0000.00613.40
8.0.120.0040.00416.90
8.0.110.0040.00416.95
8.0.100.0070.00016.78
8.0.90.0050.00216.82
8.0.80.0120.00416.85
8.0.70.0000.00816.82
8.0.60.0040.00416.88
8.0.50.0000.00716.78
8.0.30.0100.00816.99
8.0.20.0080.01117.40
8.0.10.0000.00716.91
8.0.00.0160.00316.93
7.4.330.0030.00315.55
7.4.320.0000.00616.50
7.4.300.0000.00716.65
7.4.290.0030.00316.64
7.4.280.0060.00316.63
7.4.270.0000.00716.46
7.4.260.0060.00316.63
7.4.250.0040.00416.48
7.4.240.0050.00316.54
7.4.230.0000.00816.53
7.4.220.0040.00416.64
7.4.210.0030.01116.61
7.4.200.0080.00016.74
7.4.160.0060.01016.54
7.4.140.0080.01017.86
7.4.130.0090.00916.59
7.4.120.0080.00916.57
7.4.110.0040.01316.58
7.4.100.0090.00916.38
7.4.90.0120.00616.46
7.4.80.0070.01319.39
7.4.70.0040.01916.29
7.4.60.0110.00616.52
7.4.50.0000.01616.73
7.4.40.0190.00416.59
7.4.00.0060.00714.93
7.3.330.0050.00013.36
7.3.320.0030.00313.21
7.3.310.0030.00516.26
7.3.300.0030.00316.48
7.3.290.0040.00416.28
7.3.280.0050.01316.45
7.3.260.0140.00716.51
7.3.250.0120.00816.48
7.3.240.0080.01016.39
7.3.230.0100.00716.29
7.3.210.0140.00716.68
7.3.200.0090.00916.45
7.3.190.0140.00316.53
7.3.180.0060.01116.50
7.3.170.0100.00716.50
7.3.160.0080.01216.50
7.2.330.0150.00616.74
7.2.320.0060.01316.88
7.2.310.0170.00016.91
7.2.300.0160.00616.82
7.2.290.0140.00416.56
7.2.60.0130.00016.97
7.2.30.0200.01217.91
7.2.20.0190.01118.14
7.2.10.0160.01618.05
7.2.00.0120.01717.79
7.1.200.0030.01015.86
7.1.150.0190.01116.93
7.1.140.0200.00916.52
7.1.130.0160.01516.96
7.1.120.0160.01216.81
7.1.110.0150.00815.86
7.1.100.0120.01116.45
7.1.90.0130.01216.16
7.1.80.0140.00816.43
7.1.70.0120.00615.61
7.1.60.0260.01833.40
7.1.50.0360.01332.86
7.1.40.0260.01232.58
7.1.30.0360.01132.84
7.1.20.0290.01132.96
7.1.10.0110.01114.60
7.1.00.0110.01114.97

preferences:
34.4 ms | 403 KiB | 5 Q