3v4l.org

run code in 300+ PHP versions simultaneously
<?php $database = 'id|name_sname|identity|address|region|hours|destination|price; -------------------------------------------------------------------- 1|Test Mod|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100; 2|Jhon Doe|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100; 3|Himel Rana|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100; 4|Ezra Mod|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100; 5|Keven Korp|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100; 6|Tamim Iqbal|123456789|husi, stanilesti, vaslui|HUSI - IASI|20:00|HUSI|100;'; //$data = file_get_contents("database.txt"); //read the file $rows = explode("\n", $database); //create array separate by new line $rows = array_map("trim", $rows); // for removing any unwanted space $rowCount = count($rows); // Count your database rows function CountCol($data){ $col = explode("|", $data); return count($col); } // Creating array from our text database // in our database first two rows are not needed so I am skipig this // by using i = 2 // and $rowCount -1 because of our array start from 0 but count start from 1 // adding $id[$i-2] and like other because of we have started our first loop from 2 and I want to // create my new array starting from 0 . for ($i=2; $i <$rowCount-1 ; $i++) { for ($j=0; $j < CountCol($rows[$i]) ; $j++) { $column = explode("|", $rows[$i]); $id[$i-2] = $column[0]; $name_sname[$i-2] = $column[1]; $identity[$i-2] = $column[2]; $address[$i-2] = $column[3]; $region[$i-2] = $column[4]; $hours[$i-2] = $column[5]; $destination[$i-2] = $column[6]; $price[$i-2] = $column[7]; } } // let's print our data // I am using 3 here because of we have no need first 2 rows and our array start from 0 for ($i=0; $i < $rowCount-3 ; $i++) { echo "ID: ".$id[$i] ."\r\n"; echo "name_sname: ".$name_sname[$i]."\r\n"; echo "identity: ".$identity[$i] ."\r\n"; echo "address: ".$address[$i] ."\r\n"; echo "region: ".$region[$i] ."\r\n"; echo "hours: ".$hours[$i] ."\r\n"; echo "destination: ".$destination[$i] ."\r\n"; echo "price: ".$price[$i] ."\r\n"; } // // get it like below echo "printing information using id number \r\n"; echo $name_sname[0]; // here 0 is row number or id number echo "\r\n"; echo $name_sname[1];// here 1 is row number or id number echo "\r\n"; echo $id[0]; ?>

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.70.0080.00816.38
8.3.60.0140.00016.88
8.3.50.0100.00718.14
8.3.40.0120.00618.97
8.3.30.0110.00418.96
8.3.20.0060.00320.07
8.3.10.0080.00522.87
8.3.00.0090.00522.16
8.2.180.0090.00916.88
8.2.170.0120.00622.96
8.2.160.0140.00020.58
8.2.150.0110.00324.18
8.2.140.0060.00723.29
8.2.130.0060.00822.15
8.2.120.0030.01023.51
8.2.110.0100.00421.47
8.2.100.0080.00619.28
8.2.90.0020.01019.23
8.2.80.0070.00519.57
8.2.70.0060.00618.97
8.2.60.0080.00719.15
8.2.50.0070.00718.99
8.2.40.0080.00520.29
8.2.30.0100.00419.28
8.2.20.0050.00719.31
8.2.10.0050.00619.39
8.2.00.0060.00319.33
8.1.280.0110.00425.92
8.1.270.0010.00722.00
8.1.260.0060.00125.01
8.1.250.0040.00425.96
8.1.240.0100.00219.75
8.1.230.0030.00720.70
8.1.220.0020.00619.22
8.1.210.0050.00719.49
8.1.200.0080.00018.83
8.1.190.0080.00018.86
8.1.180.0040.00419.17
8.1.170.0010.00719.42
8.1.160.0030.00519.67
8.1.150.0030.00420.33
8.1.140.0040.00418.96
8.1.130.0070.00519.01
8.1.120.0070.00418.48
8.1.110.0080.00418.42
8.1.100.0060.00518.46
8.1.90.0080.00718.46
8.1.80.0050.00718.47
8.1.70.0080.00318.41
8.1.60.0070.00418.55
8.1.50.0050.00418.48
8.1.40.0050.00418.53
8.1.30.0090.00418.22
8.1.20.0080.00618.22
8.1.10.0120.00418.17
8.1.00.0090.00517.83
8.0.300.0020.00619.70
8.0.290.0090.00217.29
8.0.280.0100.00218.21
8.0.270.0040.00418.46
8.0.260.0080.00517.70
8.0.250.0050.00517.89
8.0.240.0090.00317.23
8.0.230.0070.00617.27
8.0.220.0090.00317.21
8.0.210.0080.00217.13
8.0.200.0070.00217.17
8.0.190.0050.00417.88
8.0.180.0060.00417.80
8.0.170.0060.00917.24
8.0.160.0070.00617.49
8.0.150.0130.00417.01
8.0.140.0120.00517.02
8.0.130.0080.00716.32
8.0.120.0100.00617.04
8.0.110.0120.00417.39
8.0.100.0110.00417.04
8.0.90.0120.00317.06
8.0.80.0090.00617.44
8.0.70.0100.00517.38
8.0.60.0110.00417.02
8.0.50.0090.00517.06
8.0.30.0110.00717.38
8.0.20.0110.00717.54
8.0.10.0110.00617.16
8.0.00.0100.00317.90
7.4.330.0120.00215.09
7.4.320.0100.00416.89
7.4.300.0120.00116.84
7.4.290.0100.00216.87
7.4.280.0120.00516.72
7.4.270.0150.00316.76
7.4.260.0170.00416.78
7.4.250.0160.00316.74
7.4.240.0150.00216.78
7.4.230.0150.00516.75
7.4.220.0110.00716.64
7.4.210.0080.00916.69
7.4.200.0060.00816.72
7.4.190.0090.00616.85
7.4.180.0120.00316.80
7.4.160.0130.00516.74
7.4.150.0110.00516.83
7.4.140.0130.00717.27
7.4.130.0120.00616.68
7.4.120.0120.00616.61
7.4.110.0110.00716.69
7.4.100.0120.00516.67
7.4.90.0130.00416.64
7.4.80.0110.00517.29
7.4.70.0120.00416.68
7.4.60.0130.00516.64
7.4.50.0110.00716.51
7.4.40.0110.00616.54
7.4.30.0130.00516.57
7.4.20.0120.00516.55
7.4.10.0100.00716.56
7.4.00.0110.00616.40
7.3.330.0120.00515.92
7.3.320.0110.00715.99
7.3.310.0110.00416.58
7.3.300.0130.00316.61
7.3.290.0120.00616.52
7.3.280.0100.00716.47
7.3.270.0120.00616.74
7.3.260.0130.00616.56
7.3.250.0110.00716.53
7.3.240.0150.00516.58
7.3.230.0120.00716.58
7.3.220.0120.00516.54
7.3.210.0150.00616.54
7.3.200.0120.00516.58
7.3.190.0130.00416.57
7.3.180.0150.00616.49
7.3.170.0110.00716.60
7.3.160.0100.00816.48
7.3.150.0130.00416.45
7.3.140.0110.00716.55
7.3.130.0090.00816.48
7.3.120.0110.00716.55
7.3.110.0130.00516.47
7.3.100.0110.00616.38
7.3.90.0120.00616.39
7.3.80.0120.00716.35
7.3.70.0100.00816.22
7.3.60.0110.00716.23
7.3.50.0130.00716.18
7.3.40.0110.00716.25
7.3.30.0110.00616.20
7.3.20.0180.00516.56
7.3.10.0130.00716.54
7.3.00.0150.00616.50
7.2.340.0160.00316.70
7.2.330.0120.00816.74
7.2.320.0150.00616.71
7.2.310.0130.00516.66
7.2.300.0140.00616.65
7.2.290.0140.00616.63
7.2.280.0140.00616.67
7.2.270.0130.00616.60
7.2.260.0130.00616.68
7.2.250.0120.00716.70
7.2.240.0120.00716.67
7.2.230.0100.00816.71
7.2.220.0110.00816.50
7.2.210.0090.00816.51
7.2.200.0100.00816.33
7.2.190.0120.00616.41
7.2.180.0130.00616.37
7.2.170.0090.00816.31
7.2.160.0110.00616.40
7.2.150.0110.00916.73
7.2.140.0110.00916.82
7.2.130.0130.00816.83
7.2.120.0100.00816.79
7.2.110.0110.00816.77
7.2.100.0120.00816.83
7.2.90.0100.00916.77
7.2.80.0130.00716.75
7.2.70.0170.00716.74
7.2.60.0110.00816.68
7.2.50.0120.00816.78
7.2.40.0150.00716.80
7.2.30.0130.00816.83
7.2.20.0130.00716.83
7.2.10.0130.00716.76
7.2.00.0140.00716.82
7.1.330.0190.00716.10
7.1.320.0170.00715.87
7.1.310.0160.00715.90
7.1.300.0180.00915.70
7.1.290.0170.00815.59
7.1.280.0170.00515.68
7.1.270.0140.00815.76
7.1.260.0240.00615.65
7.1.250.0140.00815.58
7.1.240.0230.00815.59
7.1.230.0150.00815.67
7.1.220.0130.00915.65
7.1.210.0170.00715.55
7.1.200.0160.00615.66
7.1.190.0150.00815.73
7.1.180.0160.00615.65
7.1.170.0160.00715.64
7.1.160.0160.00515.64
7.1.150.0160.00715.60
7.1.140.0180.00715.67
7.1.130.0170.00615.60
7.1.120.0140.00815.60
7.1.110.0140.00715.65
7.1.100.0150.00715.83
7.1.90.0180.00815.91
7.1.80.0160.00715.88
7.1.70.0150.00815.71
7.1.60.0170.00817.31
7.1.50.0170.00817.26
7.1.40.0160.00817.22
7.1.30.0150.00917.26
7.1.20.0210.01017.24
7.1.10.0140.00815.67
7.1.00.0150.00815.65
7.0.330.0150.00715.27
7.0.320.0160.00615.32
7.0.310.0170.00615.32
7.0.300.0150.00715.34
7.0.290.0170.00515.29
7.0.280.0150.00715.31
7.0.270.0130.00715.29
7.0.260.0160.00615.30
7.0.250.0140.00915.44
7.0.240.0160.00615.61
7.0.230.0140.00915.60
7.0.220.0170.00615.55
7.0.210.0180.00915.42
7.0.200.0170.00715.45
7.0.190.0170.00715.53
7.0.180.0180.00615.40
7.0.170.0170.00615.51
7.0.160.0160.00715.39
7.0.150.0170.00715.40
7.0.140.0140.00915.41
7.0.130.0160.00615.50
7.0.120.0130.00915.40
7.0.110.0170.00715.45
7.0.100.0130.01015.42
7.0.90.0120.00915.41
7.0.80.0140.00715.44
7.0.70.0160.00515.39
7.0.60.0120.00815.42
7.0.50.0140.00715.41
7.0.40.0140.00615.48
7.0.30.0150.00615.48
7.0.20.0140.00715.43
7.0.10.0120.00815.44
7.0.00.0120.00915.39
5.6.400.0140.00715.83
5.6.390.0150.00715.83
5.6.380.0110.01015.77
5.6.370.0150.00616.13
5.6.360.0130.00816.14
5.6.350.0150.00716.01
5.6.340.0140.00815.97
5.6.330.0130.00916.05
5.6.320.0160.00716.10
5.6.310.0150.00815.96
5.6.300.0130.00915.99
5.6.290.0150.00716.12
5.6.280.0110.01016.08
5.6.270.0140.00716.06
5.6.260.0110.01016.00
5.6.250.0120.00716.01
5.6.240.0140.00716.09
5.6.230.0140.00716.15
5.6.220.0140.00916.16
5.6.210.0120.01116.06
5.6.200.0140.00716.20
5.6.190.0150.00716.17
5.6.180.0160.00716.19
5.6.170.0150.00716.20
5.6.160.0170.00716.18
5.6.150.0170.00616.17
5.6.140.0130.01016.13
5.6.130.0130.00916.12
5.6.120.0140.00916.14
5.6.110.0120.00916.16
5.6.100.0150.00816.13
5.6.90.0120.01016.08
5.6.80.0140.00715.98
5.6.70.0120.01016.01
5.6.60.0140.00916.06
5.6.50.0150.00815.99
5.6.40.0140.00716.09
5.6.30.0160.00816.03
5.6.20.0160.00616.09
5.6.10.0130.00916.06
5.6.00.0140.00816.00

preferences:
55.64 ms | 400 KiB | 5 Q