What PHP Deobfuscation Actually Does
PHP deobfuscation reverses the encoding chains that hide source code. The most common pattern is a chain of nested function calls inside eval():
eval(base64_decode('ZWNobyAiSGVsbG8iOw=='));
To decode this, you peel the layers from the inside out: Base64-decode the string, then you have the original PHP code. For eval(gzinflate(base64_decode(...))), you decompress with gzinflate after Base64-decoding. For eval(strrev(str_rot13(...))), you reverse the string then ROT13 it back [citation:3][citation:12].
The Encoding Chains This Tool Handles
| Chain | Decode Order | Notes |
|---|---|---|
| Base64 + eval | base64_decode() → PHP | Most common. Requires atob in browser. |
| GZ Deflate | gzinflate(base64_decode()) → PHP | Browser uses DecompressionStream if available. |
| ROT13 + Reverse | strrev(str_rot13()) → PHP | Pure string math, no compression. |
| Hex + eval | hex2bin() → PHP | Each byte is two hex chars. |
| Variable Rename | ❌ Not reversible | Variable names are lost permanently. The logic is still readable, just with mangled identifiers. |
What This Tool Cannot Decode
- ionCube — encrypted Zend bytecode + runtime loader. Requires the ionCube Loader extension on a PHP server.
- Zend Guard — same bytecode-encryption model. Requires Zend Loader.
- SourceGuardian — similar commercial protector.
- Custom-function obfuscation — some obfuscators use custom decoder functions with random names. You need to trace the function calls manually or use a tool like UnPHP that simulates execution [citation:11].
- Heavily nested chains — this tool handles up to ~5 layers of nesting. For 80+ layers (seen in the wild), use a dedicated recursive decoder.
How to Decode Manually (If This Tool Fails)
If the output still contains eval(...), the code has another layer. You can:
- Replace
eval(withecho (in the decoded output. - Run it in a PHP sandbox (never on a live server).
- The echo will print the next layer of code.
- Repeat until no more
evalappears.
This is exactly what tools like UnPHP and PHPDeobfuscator automate [citation:6][citation:11].
Safety Warning
system(), shell_exec(), base64_decode($_POST[...]), or unexplained curl calls, treat it as malicious [citation:10][citation:17].
Frequently Asked Questions
Is PHP deobfuscation legal?
Why does the output still contain eval()?
eval( with echo ( and run it in a sandbox to see the next layer manually.Can this decode ionCube or Zend Guard?
Does this tool upload my code to a server?
What is gzinflate and why does my browser need to decompress it?
gzinflate is PHP's zlib decompression function. To decode it in a browser, this tool uses the built-in DecompressionStream('deflate') API. If your browser doesn't support it (older Safari), the tool falls back to a pure-JS decompressor.Why can't I decode Variable Rename obfuscation?
$username from $_v1a2b.What should I do after decoding?
eval, system, shell_exec, passthru, base64_decode($_POST), file writes to unexpected paths, and outbound curl requests. If anything looks malicious, do not run it.Can I decode PHP with custom decoder functions?
$x = function($y){ return base64_decode($y); }; eval($x($payload));) require execution tracing. Use UnPHP or PHPDeobfuscator, which simulate execution [citation:6][citation:11].Is my data uploaded to your server?
Can I download the decoded PHP?
decoded.php.Related Tools
External Resources
- UnPHP — recursive PHP deobfuscator, handles 80+ layers, custom functions
- PHPDeobfuscator — PHP-based, AST-level deobfuscation
- DecodePHP — commercial service, handles ionCube/Zend/SourceGuardian
- PHP Manual: base64_decode()
- PHP Manual: gzinflate()
- PHP Manual: eval()