My apologies for not being more clear. I should know better, similar questions come up all the time.
Adding to the bottom of the plugin code page would be fine and is what I had in mind. What you posted should work perfectly with no T_FUNCTION error.
Just so you know, most code hacks of this nature can typically go in one of two places, a plugin or your theme's functions.php file. Many hackers have a special "catch-all" plugin in which they keep all their random hacks. To save hacks in a theme's functions.php file, one should create a child theme so the alterations do not get lost when the theme is updated.
Generally speaking, code snippets can go anywhere in a file, but you must be cognizant of code structures and not place snippets inside of such structures. By structures I mean mainly the
<?php ?> delimiters. Code not inside of such delimiters is treated as HTML and not executed as code.
Inside of the PHP delimiters, be careful not to insert snippets inside of other structures such as function definitions, class definitions; if/else, do/while, select/case, and other such blocks, etc.
You could even place snippets in a separate plugin file (but not separate theme files unless a template). If so, that file must be included or required on the main plugin file.
PHP is very flexible with code order, you can call a function before it is defined. It does expect a certain organization, preventing insertion of code just anywhere, but within reason code can go almost anywhere.