It isn't generally worthwhile to attempt this.
You want to hide the the PayPal button codes, but these are generated in a formulaic way by PayPal. Anyone who wants to learn about PayPal Button Codes can do that using resources already available on the web. It doesn't matter whether you obfuscate the code on your web page.
All buttons created using [the Create a PayPal payment
button page] are secure by default, so there is no further security action
so presumably some of the network security experts at PayPal have already had a chance to apply any obfuscation system they feel is necessary to the button code.
You don't need to obfuscate PHP code because you can generally keep that code secret if you want to, as many companies do.
In general when programming anything it is good practice to separate out any secret information from code to apply non-secret algorithms to that information, and store them separately. As Wikipedia says,
In cryptography, Kerckhoffs' principle [says that] a
cryptosystem should be secure even if everything about the system,
except the key, is public knowledge.