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 WP_REST_Global_Styles_Controller_X_X extends WP_REST_Global_Styles_Controller { public function update_item() { echo "\n" . __METHOD__ . "\n"; // some custom code. $this->prepare_item_for_database(); } /** * Want to invoke this method, not the parent's method. */ protected function validate_custom_css() { echo __METHOD__ . "()\n"; } } ( new WP_REST_Global_Styles_Controller_X_X() )->update_item();
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
WP_REST_Global_Styles_Controller_X_X::update_item WP_REST_Global_Styles_Controller::prepare_item_for_database WP_REST_Global_Styles_Controller::validate_custom_css()

preferences:
40.54 ms | 406 KiB | 5 Q