Possible Duplicate:
How can I obfuscate JavaScript?
I was wondering if there's a way to just move javascript around. So let's say I have a javascript file. I like to be able to have the PHP function just move the JS functions, etc around so it's less readable.
- Set path to javascript file
- Read the JS file
- Grab each JS function or jquery selector and move them around and save the file. The hard part is figuring how how to make sure each block of code is complete... hmm... maybe use 2 returns as a separator? Another idea is make each JS block a single sentence and just use PHP line shuffle?
Curious if this is do-able...
Thanks
UPDATE: What do you guys think of this? Using /// between each function and converting everything into array and then I'll randomize array and output it back out again
<?php
$file_content = file_get_contents("js/js.js");
$content = explode("///", $file_content);
echo count($content);
print_r($content);
?>