Php Obfuscator Online Info
.options background: #0a0f1a; border-radius: 1.2rem; padding: 0.8rem 1.2rem; margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
button background: #1e293b; border: none; padding: 0.7rem 1.4rem; border-radius: 2rem; font-weight: 600; font-size: 0.85rem; font-family: inherit; color: #f1f5f9; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
// Copy result copyBtn.addEventListener('click', async () => const code = outputTextarea.value; if (!code.trim()) showError('Nothing to copy — obfuscate something first.'); return; try await navigator.clipboard.writeText(code); const originalText = copyBtn.innerHTML; copyBtn.innerHTML = '✅ Copied!'; setTimeout(() => copyBtn.innerHTML = originalText; , 1500); catch (err) showError('Clipboard error: manual copy'); );
@media (max-width: 780px) .container padding: 1rem; .panel padding: 1rem; button padding: 0.5rem 1rem; </style> </head> <body> <div class="container"> <h1>🔐 PHP Obfuscator <span style="font-size:1.8rem;">⚡</span></h1> <div class="sub">Protect your PHP scripts — Rename variables, encode strings, scramble logic (executable output)</div> php obfuscator online
function showError(msg) errorDiv.innerText = msg; errorDiv.style.display = 'block'; setTimeout(() => if (errorDiv) errorDiv.style.display = 'none'; , 4000);
<!-- OUTPUT PANEL --> <div class="panel"> <div class="panel-header"> <h2>🌀 Obfuscated Result</h2> <span class="badge">copy & deploy</span> </div> <textarea id="outputCode" rows="14" placeholder="Obfuscated PHP code will appear here..." readonly style="background:#03060c;"></textarea> <div class="stats"> <span id="outputStats">Lines: 0 | Size: 0 B</span> <span>🔒 Keep <?php tags intact</span> </div> </div> </div>
h1 font-size: 2.2rem; font-weight: 700; background: linear-gradient(135deg, #c084fc, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0 0 0.35rem 0; letter-spacing: -0.3px; we skip $this and $GLOBALS if (['this', 'GLOBALS',
// Step 1: Extract variable names ($var) inside code (excluding those inside strings and comments already stripped partially) // We'll do a simple regex that finds $[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* but avoid special cases like ${} // We'll apply variable renaming only for user variables. if (optVarRename.checked) const varRegex = /\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\b/g; let match; // collect all variables const candidates = new Set(); while ((match = varRegex.exec(obfuscated)) !== null) let varName = match[1]; // skip superglobals and common reserved? keep _GET, _POST, etc but user can rename them optionally risky? we skip $this and $GLOBALS if (['this', 'GLOBALS', '_SERVER', '_GET', '_POST', '_REQUEST', '_SESSION', '_COOKIE', '_FILES', '_ENV'].includes(varName)) continue; if (varName.startsWith('_')) continue; // keep some internal? candidates.add(varName); // assign random names for (let v of candidates) if (!varMap.has(v)) varMap.set(v, randName('_v')); // replace variables in code (with word boundaries) for (let [orig, rand] of varMap.entries()) const regex = new RegExp(`\\$$orig\\b`, 'g'); obfuscated = obfuscated.replace(regex, `$$rand`);
// Step 2: Rename user defined functions (function name ...) but not built-in if (optFuncRename.checked) // match function declarations: function funcName( ... ) const funcRegex = /function\s+([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*\(/g; let funcMatch; let funcs = new Set(); while ((funcMatch = funcRegex.exec(obfuscated)) !== null) let fname = funcMatch[1]; // skip magic methods & common internal maybe, but keep user rename if (['__construct', '__destruct', '__call', '__get', '__set', '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke', '__clone'].includes(fname)) continue; funcs.add(fname); for (let f of funcs) if (!funcMap.has(f)) funcMap.set(f, randName('_f')); for (let [orig, rand] of funcMap.entries()) const regexFuncDec = new RegExp(`function\\s+$orig\\s*\\(`, 'g'); obfuscated = obfuscated.replace(regexFuncDec, `function $rand(`); // also replace function calls: but careful not to replace inside strings, we do a global call pattern: foo( ... ) const callRegex = new RegExp(`\\b$orig\\s*\\(`, 'g'); obfuscated = obfuscated.replace(callRegex, `$rand(`);
.panel flex: 1; min-width: 280px; background: #0f172ad9; border-radius: 1.5rem; padding: 1.25rem; backdrop-filter: blur(4px); border: 1px solid #1e293b; transition: all 0.2s; ) const callRegex = new RegExp(`\\b$orig\\s*\\(`
// ---- Helper: generate random name ---- function randName(prefix = '_') const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let name = prefix; for (let i = 0; i < 6; i++) name += chars[Math.floor(Math.random() * chars.length)]; return name;
inputTextarea.addEventListener('input', () => updateStats(inputTextarea, inputStatsSpan)); outputTextarea.addEventListener('input', () => updateStats(outputTextarea, outputStatsSpan)); // not editable but keep
textarea width: 100%; background: #010409; border: 1px solid #2d3a5e; border-radius: 1rem; padding: 1rem; font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace; font-size: 0.85rem; line-height: 1.5; color: #e2e8f0; resize: vertical; outline: none; transition: 0.2s;
input[type="checkbox"] width: 16px; height: 16px; accent-color: #3b82f6;
