How to show phpinfo() only in a new tab?

If you are displaying the info in the front-end, hook into wp or init, otherwise init or admin_init will work on admin:

add_action('wp', function() {
    if( current_user_can("manage_options") && ! is_feed() && isset( $_GET["my_plugin_show_phpinfo"] ) ) {
        ?>

            <!-- Output things -->

            <?php phpinfo(); ?>

        <?php
        exit;
    }
});

Now if you go to http://example.com/?my_plugin_show_phpinfo=1 it will display your custom content only. Hope that helps.

Edit: Added conditional to limit the tab for admins only. Thanks TomC!