3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Teacher { public function getStudentTeacherColumn(array $data, int|string $col): array { return array_map([$this, 'myarraymap'], $data['student_teacher']); } private function myarraymap(array $studentTeacher): mixed { return $studentTeacher['user_id']; // statically accessing column to demonstrate desired output } } $data = [ 'student_teacher' => [ ['user_id' => 1, 'user_name' => 'foo'], ['user_id' => 2, 'user_name' => 'bar'], ['user_id' => 3, 'user_name' => 'bam'], ] ]; $teacher = new Teacher; var_export($teacher->getStudentTeacherColumn($data, 'user_id')); echo "\n---\n"; $col = 'user_id'; var_export(array_column($data['student_teacher'], $col));

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.130.0100.01117.41
8.4.120.0030.01320.63
8.4.110.0120.00918.98
8.4.100.0140.00817.79
8.4.90.0080.01017.90
8.4.80.0100.01019.57
8.4.70.0130.00819.48
8.4.60.0140.00618.82
8.4.50.0060.00518.84
8.4.40.0150.00617.97
8.4.30.0070.01120.39
8.4.20.0090.00317.81
8.4.10.0040.00422.15
8.3.250.0090.00918.95
8.3.240.0140.00816.61
8.3.230.0110.00716.63
8.3.220.0140.00516.63
8.3.210.0040.00416.62
8.3.200.0050.00416.63
8.3.190.0100.00816.91
8.3.180.0090.00716.56
8.3.170.0060.01217.04
8.3.160.0050.00218.28
8.3.150.0150.00320.90
8.3.140.0040.00419.05
8.3.130.0070.00318.50
8.3.120.0060.00318.79
8.3.110.0040.00420.94
8.3.100.0080.00024.06
8.3.90.0040.00426.77
8.3.80.0030.00618.31
8.3.70.0110.01116.50
8.3.60.0140.00718.42
8.3.50.0070.00718.48
8.3.40.0040.01121.84
8.3.30.0100.00319.04
8.3.20.0040.00424.18
8.3.10.0070.00024.66
8.3.00.0040.00426.16
8.2.290.0110.00720.59
8.2.280.0070.00318.29
8.2.270.0110.00817.03
8.2.260.0040.01119.00
8.2.250.0050.00316.61
8.2.240.0150.00017.27
8.2.230.0030.00622.58
8.2.220.0030.00537.54
8.2.210.0080.00026.77
8.2.200.0040.00418.16
8.2.190.0140.00716.63
8.2.180.0140.00718.29
8.2.170.0150.00319.09
8.2.160.0110.00422.96
8.2.150.0070.00025.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.67
8.2.110.0130.00322.10
8.2.100.0110.00017.72
8.2.90.0230.00717.63
8.2.80.0230.00717.47
8.2.70.0300.00017.38
8.2.60.0220.00917.13
8.2.50.0220.00717.49
8.2.40.0260.00217.50
8.2.30.0270.00417.50
8.2.20.0160.00017.63
8.2.10.0230.00617.13
8.2.00.0180.01117.10
8.1.330.0120.00818.03
8.1.320.0130.00818.06
8.1.310.0030.00517.02
8.1.300.0000.00816.22
8.1.290.0090.00030.84
8.1.280.0100.00725.92
8.1.270.0080.00024.66
8.1.260.0070.00026.35
8.1.250.0000.00728.09
8.1.240.0030.00723.96
8.1.230.0080.00320.90
8.1.220.0280.00316.88
8.1.210.0240.00617.35
8.1.200.0230.00717.13
8.1.190.0260.00716.87
8.1.180.0180.00917.13
8.1.170.0210.00717.13
8.1.160.0240.00317.25
8.1.150.0160.01216.98
8.1.140.0190.01017.12
8.1.130.0180.00917.25
8.1.120.0200.00817.25
8.1.110.0220.00617.13
8.1.100.0240.00516.97
8.1.90.0200.00717.38
8.1.80.0220.00617.00
8.1.70.0170.00617.57
8.1.60.0220.00617.38
8.1.50.0270.00017.13
8.1.40.0180.01117.38
8.1.30.0140.01117.33
8.1.20.0260.00317.46
8.1.10.0200.00717.25
8.1.00.0200.00817.00
8.0.300.0210.00716.80
8.0.290.0210.00816.80
8.0.280.0170.00816.80
8.0.270.0180.01016.80
8.0.260.0270.00016.80
8.0.250.0250.00316.80
8.0.240.0240.00616.80
8.0.230.0320.00416.80
8.0.220.0240.00816.80
8.0.210.0260.00516.80
8.0.200.0240.00516.80
8.0.190.0260.00416.80
8.0.180.0260.00516.80
8.0.170.0240.00316.80
8.0.160.0240.00316.80
8.0.150.0180.00916.80
8.0.140.0240.00316.80
8.0.130.0220.01016.80
8.0.120.0270.00016.80
8.0.110.0250.00016.80
8.0.100.0200.00816.80
8.0.90.0200.00716.80
8.0.80.0150.01218.18
8.0.70.0220.00716.80
8.0.60.0270.00016.80
8.0.50.0240.00316.80
8.0.30.0240.00516.80
8.0.20.0230.00516.80
8.0.10.0240.00416.80

preferences:
26.48 ms | 403 KiB | 5 Q