3v4l.org

run code in 300+ PHP versions simultaneously
<?php class WP_REST_Global_Styles_Controller { public function update_item() { echo "\n" . __METHOD__ . "\n"; $this->prepare_item_for_database(); } protected function prepare_item_for_database() { echo "\n" . __METHOD__ . "\n"; $this->validate_custom_css(); } private function validate_custom_css() { echo __METHOD__ . "()\n"; } } class Gutenberg_REST_Global_Styles_Controller extends WP_REST_Global_Styles_Controller { protected function prepare_item_for_database() { echo "\n" . __METHOD__ . "\n"; $this->validate_custom_css(); } /** * Copy of the parent's method. * The parent's method is private, meaning a child cannot overload or invoke it. * But a child class can have a method with the same name and different visibility. */ protected function validate_custom_css() { echo __METHOD__ . "()\n"; } } class Gutenberg_REST_Global_Styles_Controller_X_X extends Gutenberg_REST_Global_Styles_Controller {} class WP_REST_Global_Styles_Controller_X_X extends WP_REST_Global_Styles_Controller { // will cause a fatal error. protected function prepare_item_for_database() { // overloads the parent's method. echo "\n" . __METHOD__ . "\n"; $this->validate_custom_css(); // will cause a fatal error, as the parent's method is private to it. } } ( new Gutenberg_REST_Global_Styles_Controller() )->update_item(); ( new Gutenberg_REST_Global_Styles_Controller_X_X() )->update_item(); ( new WP_REST_Global_Styles_Controller_X_X() )->update_item();

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.20.0130.00718.76
8.4.10.0030.00719.41
8.3.150.0090.00920.66
8.3.140.0110.00716.63
8.3.130.0030.00518.80
8.3.120.0060.01020.83
8.3.110.0000.00820.94
8.3.100.0030.00624.06
8.3.90.0000.01526.77
8.3.80.0030.00617.97
8.3.70.0080.00818.31
8.3.60.0060.00916.63
8.3.50.0070.00718.78
8.3.40.0110.00420.34
8.3.30.0110.00421.73
8.3.20.0080.00024.18
8.3.10.0000.00724.66
8.3.00.0070.00026.16
8.2.270.0110.00717.16
8.2.260.0060.01219.88
8.2.250.0090.00018.70
8.2.240.0120.00319.07
8.2.230.0060.00322.58
8.2.220.0070.01137.54
8.2.210.0070.01026.77
8.2.200.0060.00318.43
8.2.190.0110.00418.28
8.2.180.0000.01516.88
8.2.170.0120.00618.91
8.2.160.0100.00722.96
8.2.150.0040.00425.66
8.2.140.0160.00324.66
8.2.130.0000.00726.16
8.2.120.0060.00318.77
8.2.110.0070.01420.43
8.2.100.0080.01219.27
8.2.90.0140.00719.02
8.2.80.0240.00618.64
8.2.70.0270.00718.68
8.2.60.0380.00018.88
8.2.50.0290.01118.84
8.2.40.0210.01418.78
8.2.30.0120.00818.70
8.2.20.0200.00718.68
8.2.10.0320.00318.56
8.2.00.0170.01018.91
8.1.310.0000.00818.66
8.1.300.0150.00417.54
8.1.290.0030.00630.84
8.1.280.0160.00325.92
8.1.270.0070.01123.99
8.1.260.0080.00026.35
8.1.250.0070.00328.09
8.1.240.0240.01018.45
8.1.230.0230.00718.68
8.1.220.0240.00718.35
8.1.210.0140.00719.84
8.1.200.0150.01518.63
8.1.190.0130.00318.38
8.1.180.0190.01118.25
8.1.170.0130.00318.41
8.1.160.0210.00318.48
8.1.150.0160.01320.45
8.1.140.0150.00018.34
8.1.130.0110.00418.48
8.1.120.0080.00618.56
8.1.110.0200.00718.44
8.1.100.0250.00618.50
8.1.90.0240.00618.37
8.1.80.0270.00718.50
8.1.70.0160.01018.80
8.1.60.0330.01018.64
8.1.50.0260.00318.74
8.1.40.0200.00918.62
8.1.30.0040.00918.94
8.1.20.0290.01018.71
8.1.10.0230.01018.61
8.1.00.0140.00718.56
8.0.300.0180.01517.82
8.0.290.0150.00018.00
8.0.280.0080.00617.77
8.0.270.0180.00017.96
8.0.260.0110.00517.81
8.0.250.0140.00317.86
8.0.240.0050.01417.88
8.0.230.0180.01218.34
8.0.220.0160.00617.83
8.0.210.0280.00317.75
8.0.200.0200.01017.89
8.0.190.0150.00317.84
8.0.180.0170.00317.76
8.0.170.0070.00717.89
8.0.160.0290.00617.92
8.0.150.0190.00617.67
8.0.140.0090.00917.73
8.0.130.0000.01318.25
8.0.120.0110.00517.63
8.0.110.0150.00018.05
8.0.100.0110.00617.79
8.0.90.0110.00317.88
8.0.80.0160.01217.86
8.0.70.0200.01317.88
8.0.60.0090.00917.70
8.0.50.0100.00817.79
8.0.30.0140.01417.86
8.0.20.0220.01617.87
8.0.10.0260.00317.74

preferences:
27.86 ms | 403 KiB | 5 Q