OK, that helps, but I'm still a little uncertain where you're going with this. I will focus on you want to do something in PHP when an URL is requested.
The add_menu_page() was not a good analogy actually. When you provide a function argument, the menu_slug argument becomes just a label. The URL is never requested, only the function is called. Anyway...
I'll assume you have a link(s) on your site to an arbitrary PHP page that you've created. It may or may not contain HTML elements. If you want this page to do something in PHP, you don't necessarily need a function, any code encountered outside of a function or similar definition will be executed immediately. Or you can define a function and then have the page immediately call the function upon page load.
If you want to use WordPress functions on this page, you need to initiate the WordPress environment. This is best done with
require_once(wp-load.php); , with the path corrected as needed. If the user must be logged in, require once wp-admin/admin.php instead.
I hope this helps, if I have misunderstood, I apologize, please try to explain again an I'll do my best to help.