Obfuscate text source


/ Published in: PHP
Save to your folder(s)

This function does not scramble the output text. But it obfuscates the text in the source code. A very useful function to "hide" emails and other things that you dont want robots to find..

Usage:
echo scramble("scramble me");

Result:
- Front: scramble me
- Source: scramble me


Copy this code and paste it in your HTML
  1. function scramble($text)
  2. {
  3. $length = strlen($text);
  4. $output = '';
  5.  
  6. for ($i = 0; $i < $length; $i++)
  7. {
  8. $output .= "&#" . ord(substr($text,$i,1)) . ";";
  9. }
  10. return $output;
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.