Should this still work in 2.2.4? The contents of this file aren't being output on the page.

{include_php file="/path/to/my/custom.php"}

Probably depends upon the settings in config.local.php for allow templates to use PHP code.

But why woud you want to do that in a template?

It does work in a template, and can be useful if the objective is simple enough to not require an addon.

We struggled with this for a while, needing custom code to handle data from the store talking to another database. In the end, it proved better to include the PHP inside the .tpl file.