Posted By

Helbom on 01/14/10


Tagged

String obfuscate scramble


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wirenaught


Obfuscate text source


 / Published in: PHP
 

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

  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  

You need to login to post a comment.