I have managed to code a feature which takes my entire library's many .php files, bake them into a single PHP file, then removes all code comments and blankspaces. That part works perfectly and the result is a messy, single PHP file.
However, all the function names, variable names and constants (also classes and whatnot) are still intact. I use extremely descriptive ones because it helps me code:
<?php $customer_total_account_balance = accounts_fetch_balance_for_account_id(4252392533521);
I want this to be come:
<?php $a = b(4252392533521);
I will not attempt to code this on my own. It's a can of worms of problems. I have tried many times in the past but always got stuck because it's not trivial. It must of course not introduce bugs and issues with the code!
The fact that it only has to work on a single PHP file should make it more likely that it does exist, though.
The purpose of this is to be able to put code of "private nature" on untrusted/shared servers, making the impact of somebody reading or copying it far less problematic than if they had also got the full dir/file structure, all the code comments, all the whitespace intact and of course all the identifiers.