button.warning background: #7c2d12; color: #fed7aa;
// Step 3: Encode strings (base64 + eval / base64_decode) if (optStringEncode.checked) // Find double quoted and single quoted strings (excluding heredoc for simplicity) // Replace string literals with: base64_decode('...') but careful to avoid overlapping and small strings // We will process string tokens that are not inside existing encoded. // Replace both "..." and '...' , but skip strings with interpolation for double quotes? safer to handle single quote and simple double quote. // Use function that encodes string content. function encodeString(match, quote, content) content.includes('eval') // handle single quotes: 'text' const singleQuoteRegex = /'([^'\\]*(?:\\.[^'\\]*)*)'/g; obfuscated = obfuscated.replace(singleQuoteRegex, (match, content) => if (content.includes('base64_decode')) return match; if (content.length < 3) return match; const encoded = btoa(unescape(encodeURIComponent(content))); return `base64_decode('$encoded')`; ); // handle double quotes (do not handle complex interpolation, but simple) const doubleQuoteRegex = /"([^"\\]*(?:\\.[^"\\]*)*)"/g; obfuscated = obfuscated.replace(doubleQuoteRegex, (match, content) => if (content.includes('base64_decode')) return match; if (content.length < 2) return match; const encoded = btoa(unescape(encodeURIComponent(content))); return `base64_decode('$encoded')`; ); // ensure we have base64_decode function available: add helper at top if not exists if (!obfuscated.includes('function base64_decode')) // we prepend a small note but don't break; base64_decode is builtin PHP function. no need to define
.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.secondary:hover background: #3b4a70; php obfuscator online
// store mapping for variables and functions let varMap = new Map(); let funcMap = new Map();
.stats display: flex; justify-content: space-between; margin-top: 0.8rem; font-size: 0.7rem; color: #6c86a3;
.error color: #f87171; background: #7f1a1a30; padding: 0.4rem 1rem; border-radius: 1rem; font-size: 0.8rem; margin-top: 0.5rem; button
<div class="two-columns"> <!-- INPUT PANEL --> <div class="panel"> <div class="panel-header"> <h2>📄 Original PHP Code</h2> <span class="badge">paste your script</span> </div> <textarea id="inputCode" rows="14" placeholder="<?php // Example PHP code $message = 'Hello World'; function greet($name) return 'Welcome ' . $name; echo greet($message); ?>"></textarea> <div class="stats"> <span id="inputStats">Lines: 0 | Size: 0 B</span> <span>✨ Obfuscation level: Medium/High</span> </div> </div>
// Options checkboxes const optVarRename = document.getElementById('optVarRename'); const optFuncRename = document.getElementById('optFuncRename'); const optStringEncode = document.getElementById('optStringEncode'); const optStripSpace = document.getElementById('optStripSpace'); const optNumObf = document.getElementById('optNumObf');
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>PHP Obfuscator Pro | Online Code Protector</title> <meta name="description" content="Free online PHP obfuscator to protect your source code. Encrypt variables, functions, strings and make PHP code unreadable yet executable."> <style> * box-sizing: border-box; // Use function that encodes string content
// ------------------- CORE OBFUSCATION ENGINE ------------------ // This is a lightweight but powerful obfuscator that respects PHP syntax. // It handles variables, functions, strings, numbers, whitespace. // Note: not a full AST parser but regex + smart token simulation.
.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;
button.primary:hover background: linear-gradient(95deg, #3b82f6, #6366f1); transform: translateY(-1px);
button.warning background: #7c2d12; color: #fed7aa;
// Step 3: Encode strings (base64 + eval / base64_decode) if (optStringEncode.checked) // Find double quoted and single quoted strings (excluding heredoc for simplicity) // Replace string literals with: base64_decode('...') but careful to avoid overlapping and small strings // We will process string tokens that are not inside existing encoded. // Replace both "..." and '...' , but skip strings with interpolation for double quotes? safer to handle single quote and simple double quote. // Use function that encodes string content. function encodeString(match, quote, content) content.includes('eval') // handle single quotes: 'text' const singleQuoteRegex = /'([^'\\]*(?:\\.[^'\\]*)*)'/g; obfuscated = obfuscated.replace(singleQuoteRegex, (match, content) => if (content.includes('base64_decode')) return match; if (content.length < 3) return match; const encoded = btoa(unescape(encodeURIComponent(content))); return `base64_decode('$encoded')`; ); // handle double quotes (do not handle complex interpolation, but simple) const doubleQuoteRegex = /"([^"\\]*(?:\\.[^"\\]*)*)"/g; obfuscated = obfuscated.replace(doubleQuoteRegex, (match, content) => if (content.includes('base64_decode')) return match; if (content.length < 2) return match; const encoded = btoa(unescape(encodeURIComponent(content))); return `base64_decode('$encoded')`; ); // ensure we have base64_decode function available: add helper at top if not exists if (!obfuscated.includes('function base64_decode')) // we prepend a small note but don't break; base64_decode is builtin PHP function. no need to define
.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.secondary:hover background: #3b4a70;
// store mapping for variables and functions let varMap = new Map(); let funcMap = new Map();
.stats display: flex; justify-content: space-between; margin-top: 0.8rem; font-size: 0.7rem; color: #6c86a3;
.error color: #f87171; background: #7f1a1a30; padding: 0.4rem 1rem; border-radius: 1rem; font-size: 0.8rem; margin-top: 0.5rem;
<div class="two-columns"> <!-- INPUT PANEL --> <div class="panel"> <div class="panel-header"> <h2>📄 Original PHP Code</h2> <span class="badge">paste your script</span> </div> <textarea id="inputCode" rows="14" placeholder="<?php // Example PHP code $message = 'Hello World'; function greet($name) return 'Welcome ' . $name; echo greet($message); ?>"></textarea> <div class="stats"> <span id="inputStats">Lines: 0 | Size: 0 B</span> <span>✨ Obfuscation level: Medium/High</span> </div> </div>
// Options checkboxes const optVarRename = document.getElementById('optVarRename'); const optFuncRename = document.getElementById('optFuncRename'); const optStringEncode = document.getElementById('optStringEncode'); const optStripSpace = document.getElementById('optStripSpace'); const optNumObf = document.getElementById('optNumObf');
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>PHP Obfuscator Pro | Online Code Protector</title> <meta name="description" content="Free online PHP obfuscator to protect your source code. Encrypt variables, functions, strings and make PHP code unreadable yet executable."> <style> * box-sizing: border-box;
// ------------------- CORE OBFUSCATION ENGINE ------------------ // This is a lightweight but powerful obfuscator that respects PHP syntax. // It handles variables, functions, strings, numbers, whitespace. // Note: not a full AST parser but regex + smart token simulation.
.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;
button.primary:hover background: linear-gradient(95deg, #3b82f6, #6366f1); transform: translateY(-1px);