On a recent wordpress project i need to feature a custom text to the frontend. Therefore I used advanced custom fields plugin to create that choice. However you need to place that show php code snippet inside theme files to envision that in frontend. You cannot place that snippet within a post or page.
I goggled and located an useful plugin “Insert PHP Code Snippet“. It converts your php snippet to shortcode and you’ll be able to use that shortcode within your post or page. It is a handy plugin for developers. You can donate the plugin author, in order that he’ll continue the plugin development.