3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unregister_setting( $option_group, $option_name, $deprecated = '' ) { global $new_allowed_options; // Before. $pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true ); // After. return $pos; } // Scenario 1: Raises "Warning: Trying to access array offset on value of type null" echo "Scenario 1: \n"; $new_allowed_options = null; var_dump( unregister_setting( 'unknown_setting_group', 'unknown_setting_name' ) ); // Scenario 2: Raises "Warning: Undefined array key "unknown_setting_group" " echo "\nScenario 2: \n"; $new_allowed_options = array(); var_dump( unregister_setting( 'unknown_setting_group', 'unknown_setting_name' ) ); // Scenario 3: Does not riase a Notice|Warning. echo "\nScenario 3: \n"; $new_allowed_options = array( 'unknown_setting_group' => array() ); var_dump( unregister_setting( 'unknown_setting_group', 'unknown_setting_name' ) ); // Scenario 4: Does not riase a Notice|Warning. echo "\nScenario 4: \n"; $new_allowed_options = array( 'unknown_setting_group' => null ); var_dump( unregister_setting( 'unknown_setting_group', 'unknown_setting_name' ) );

preferences:
66.69 ms | 405 KiB | 5 Q