note 48861 added to function.bin2hex

From: Date: Sun, 09 Jan 2005 21:30:14 +0000
Subject: note 48861 added to function.bin2hex
Groups: php.notes 
Request: Send a blank email to php-notes+get-83006@lists.php.net to get a copy of this message
This function returns the string $str in htmlentity hex format (&#xnumber;). It is useful to prevent spam bots indexing your email adress. <?php function hexentities($str) { $return = ''; for($i = 0; $i < strlen($str); $i++) { $return .= '&#x'.bin2hex(substr($str, $i, 1)).';'; } return $return; } ?> example: <?php echo 'email: <address>'.hexentities('foo@bar').'</address>'; ?> will return: email: <address>&#x66;&#x6f;&#x6f;&#x40;&#x62;&#x61;&#x72;</address> the browser will show foo@bar. ---- Manual Page -- http://www.php.net/manual/en/function.bin2hex.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48861 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48861&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48861&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83006) next »