3v4l.org

run code in 300+ PHP versions simultaneously
<?php function userActions(): \Closure { $startUserRecord = static function( string $firstName, string $lastName, string $companyName, string $companyAddress ) { return new class(...func_get_args()) { private $payload = []; private $firstName; private $lastName; private $companyName; private $companyAddress; public function __construct( string $firstName, string $lastName, string $companyName, string $companyAddress ) { $this->payload = func_get_args(); $this->firstName = $firstName; $this->lastName = $lastName; $this->companyName = $companyName; $this->companyAddress = $companyAddress; } public function validate(): array { // Here is where you would actually validate this one message. // Empty array means no validation messages. return []; } public function payload(): array { return $this->payload; } }; }; // Other ones go here, too. $saveUserProfile = static function() { /* ... */ }; $resetUserLogin = static function() { /* ... */ }; $activities = [ 'startUserRecord' => $startUserRecord, 'saveUserProfile ' => $saveUserProfile, 'resetUserLogin ' => $resetUserLogin, ]; return static function(/* autoset as $get */) use($activities) { $get = func_get_args(); $find = static function($name) use(&$get) { return in_array($name, $get); }; $filtered = array_filter($activities, $find, ARRAY_FILTER_USE_KEY); $found = []; // Keep in the same order. foreach($get as $name) { $found[] = $filtered[$name]; } return $found; }; } $fields = [ 'firstName' => 'First Name', 'lastName' => 'Last Name', 'companyName' => 'Company Name', 'companyAddress' => 'Company Address', ]; $userActivities = userActions(); [$startUserRecord] = $userActivities('startUserRecord'); $activity = $startUserRecord(...array_values($fields)); var_dump($fields, $activity->validate(), $activity->payload());

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.5.30.0090.00917.48
8.5.20.0080.01021.16
8.5.10.0140.00516.70
8.5.00.0120.01320.11
8.4.180.0130.00921.54
8.4.170.0150.00623.96
8.4.160.0140.00823.07
8.4.150.0090.00516.85
8.4.140.0120.01017.86
8.4.130.0090.01217.65
8.4.120.0100.01020.68
8.4.110.0120.00622.45
8.4.100.0130.00817.88
8.4.90.0090.01122.52
8.4.80.0110.00519.44
8.4.70.0130.00817.87
8.4.60.0160.00418.91
8.4.50.0030.00720.45
8.4.40.0000.01017.67
8.4.30.0090.00620.66
8.4.20.0130.00618.88
8.4.10.0060.00317.86
8.3.300.0100.01120.79
8.3.290.0150.00620.95
8.3.280.0120.00918.65
8.3.270.0120.00816.79
8.3.260.0090.01116.68
8.3.250.0140.00518.81
8.3.240.0120.00816.27
8.3.230.0090.01016.66
8.3.220.0040.00417.17
8.3.210.0080.00618.59
8.3.200.0060.00316.82
8.3.190.0120.00819.25
8.3.180.0080.00616.59
8.3.170.0110.00817.12
8.3.160.0110.00718.27
8.3.150.0090.00917.36
8.3.140.0000.00820.84
8.3.130.0100.00618.39
8.3.120.0140.00016.57
8.3.110.0100.00616.88
8.3.100.0080.00020.12
8.3.90.0120.00316.52
8.3.80.0070.00318.56
8.3.70.0040.01116.75
8.3.60.0180.00416.88
8.3.50.0160.00521.09
8.3.40.0150.00018.82
8.3.30.0040.01118.59
8.3.20.0000.00821.03
8.3.10.0000.00720.23
8.3.00.0050.00323.66
8.2.300.0140.00918.13
8.2.290.0110.00820.31
8.2.280.0120.00618.50
8.2.270.0040.01516.98
8.2.260.0000.00819.05
8.2.250.0080.00017.02
8.2.240.0090.00019.00
8.2.230.0100.00620.94
8.2.220.0040.00424.06
8.2.210.0060.00326.77
8.2.200.0060.00318.29
8.2.190.0140.00418.41
8.2.180.0080.00816.63
8.2.170.0140.00022.96
8.2.160.0070.00720.36
8.2.150.0110.00024.18
8.2.140.0050.00324.66
8.2.130.0030.00626.16
8.2.120.0040.00421.00
8.2.110.0070.00320.52
8.2.100.0040.00818.22
8.2.90.0060.00317.88
8.2.80.0050.00317.97
8.2.70.0050.00318.04
8.2.60.0040.00418.20
8.2.50.0040.00418.10
8.2.40.0000.00819.26
8.2.30.0050.00219.39
8.2.20.0040.00418.14
8.2.10.0040.00419.27
8.2.00.0040.00419.39
8.1.340.0110.01117.64
8.1.330.0120.00621.92
8.1.320.0130.00815.97
8.1.310.0070.01118.51
8.1.300.0160.00320.26
8.1.290.0090.00018.88
8.1.280.0190.00325.92
8.1.270.0080.00022.05
8.1.260.0120.00326.35
8.1.250.0000.00828.09
8.1.240.0040.00422.13
8.1.230.0060.00619.04
8.1.220.0080.00017.77
8.1.210.0000.00818.77
8.1.200.0030.00617.22
8.1.190.0030.00517.35
8.1.180.0080.00018.10
8.1.170.0050.00318.50
8.1.160.0000.00718.95
8.1.150.0040.00418.95
8.1.140.0000.00720.97
8.1.130.0030.00321.83
8.1.120.0030.00717.46
8.1.110.0030.00617.40
8.1.100.0030.00517.38
8.1.90.0000.00717.36
8.1.80.0070.00017.38
8.1.70.0000.00717.52
8.1.60.0050.00317.55
8.1.50.0040.00417.52
8.1.40.0000.00817.52
8.1.30.0000.00717.54
8.1.20.0060.00317.62
8.1.10.0040.00417.51
8.1.00.0040.00817.45
8.0.300.0050.00219.61
8.0.290.0000.00716.88
8.0.280.0030.00518.45
8.0.270.0050.00317.28
8.0.260.0060.00020.15
8.0.250.0000.01016.88
8.0.240.0030.00316.86
8.0.230.0050.00316.99
8.0.220.0050.00316.84
8.0.210.0030.00316.91
8.0.200.0030.00516.98
8.0.190.0060.00316.98
8.0.180.0000.00816.96
8.0.170.0030.00716.95
8.0.160.0000.00816.90
8.0.150.0000.00716.83
8.0.140.0000.00716.89
8.0.130.0000.00513.42
8.0.120.0000.00816.96
8.0.110.0040.00416.74
8.0.100.0080.00016.90
8.0.90.0030.00616.79
8.0.80.0130.00616.91
8.0.70.0020.00516.88
8.0.60.0000.00716.73
8.0.50.0000.00817.02
8.0.30.0080.01417.44
8.0.20.0170.00317.02
8.0.10.0050.00316.81
8.0.00.0100.00916.74
7.4.330.0000.00515.55
7.4.320.0030.00316.60
7.4.300.0030.00316.43
7.4.290.0030.00316.66
7.4.280.0060.00316.50
7.4.270.0070.00016.60
7.4.260.0030.00313.32
7.4.250.0050.00316.59
7.4.240.0040.00316.52
7.4.230.0000.00716.64
7.4.220.0030.00416.68
7.4.210.0080.00916.57
7.4.200.0030.00316.43
7.4.130.0090.00916.65
7.4.120.0120.00616.39
7.4.110.0070.01316.43
7.4.100.0180.00416.49
7.4.90.0130.00316.37
7.4.80.0130.00519.39
7.4.70.0120.00816.57
7.4.60.0080.01016.46
7.4.50.0000.01516.36
7.4.40.0140.00916.67
7.4.10.0040.01514.83
7.4.00.0050.00915.06
7.3.330.0070.00016.28
7.3.320.0050.00013.37
7.3.310.0070.00016.43
7.3.300.0040.00416.41
7.3.290.0030.00316.38
7.3.280.0080.00816.43
7.3.260.0110.00716.54
7.3.240.0110.00916.52
7.3.230.0090.01216.63
7.3.210.0070.01016.48
7.3.200.0120.00416.28
7.3.190.0120.00616.52
7.3.180.0030.01416.59
7.3.170.0080.01116.44
7.3.160.0070.01116.54
7.3.130.0030.01614.84
7.3.120.0040.01514.86
7.3.110.0030.01314.84
7.3.100.0030.01315.03
7.3.90.0000.00914.88
7.3.80.0100.00314.71
7.3.70.0070.00714.78
7.3.60.0090.00714.65
7.3.50.0070.01014.62
7.3.40.0060.00614.62
7.3.30.0040.00714.68
7.3.20.0050.00715.54
7.3.10.0110.00415.60
7.3.00.0080.00415.66
7.2.330.0060.01216.77
7.2.320.0100.00716.48
7.2.310.0030.01416.79
7.2.300.0120.00516.77
7.2.290.0070.01116.81
7.2.260.0090.00615.07
7.2.250.0090.00914.88
7.2.240.0030.01414.93
7.2.230.0060.00915.11
7.2.220.0100.00315.04
7.2.210.0070.00815.17
7.2.200.0080.00614.89
7.2.190.0060.01114.81
7.2.180.0070.00814.81
7.2.170.0070.00614.85
7.2.160.0030.00914.74
7.2.150.0060.01015.84
7.2.140.0090.00615.91
7.2.130.0070.00815.83
7.2.120.0080.00915.71
7.2.110.0070.00815.83
7.2.100.0880.01015.65
7.2.90.0060.01015.84
7.2.80.0060.01115.94
7.2.70.0100.00815.91
7.2.60.0100.01115.66
7.2.50.0100.00815.91
7.2.40.0090.00915.92
7.2.30.0130.00515.75
7.2.20.0070.00515.82
7.2.10.0120.00315.89
7.2.00.0090.00915.96
7.1.330.0070.00715.67
7.1.320.0000.00915.79
7.1.310.0060.00514.80
7.1.300.0080.01014.86
7.1.290.0060.00914.71
7.1.280.0080.00614.70
7.1.270.0110.00414.76
7.1.260.0110.00314.63
7.1.250.0070.00714.72
7.1.240.0090.00015.55
7.1.230.0030.00915.66
7.1.220.0040.01115.69
7.1.210.0070.01015.41
7.1.200.0030.01415.93
7.1.190.0070.01015.89
7.1.180.0040.00415.41
7.1.170.0070.01015.92
7.1.160.0110.00615.84
7.1.150.0140.00415.52
7.1.140.0060.00315.87
7.1.130.0040.01115.82
7.1.120.0030.00615.80
7.1.110.0040.01115.54
7.1.100.0030.01415.91
7.1.90.0070.00715.63
7.1.80.0120.00315.52
7.1.70.0100.00715.81
7.1.60.0070.01115.45
7.1.50.0030.00915.95
7.1.40.0060.00615.80
7.1.30.0070.00715.73
7.1.20.0030.00615.71
7.1.10.0100.00015.79
7.1.00.0030.01015.70

preferences:
62.11 ms | 1707 KiB | 5 Q