note 80185 added to function.bin2hex
| From: | codeguru at crazyprogrammer dot cba dot pl | Date: | Thu, 03 Jan 2008 12:06:27 +0000 |
| Subject: | note 80185 added to function.bin2hex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134711@lists.php.net to get a copy of this message | ||
<?php
function ASCIItoANSI($text2encode,$m=Null){
if ($m<>0){$mode = "&";}else{$mode = chr(38);}
// starting loop incl. lenght of base string
for ($i=0;$i<=strlen($text2encode)-1;++$i)
{
// add first & char # char + converted 2 ANSI codes
$ANSI .= $mode.chr(35).hexdec(bin2hex($text2encode[$i]));
}
echo $ANSI; // Here`s Really string contains ANSI codes
}
// **************** U S A G E ********************//
// ASCIItoANSI (String or $SomeVar);
// ^^^^^ returns converted 2 ANSI
// ^^^ [ Can be used on WWW ]
// ASCIItoANSI (String or $SomeVar,1);
// ^^^^^^ returns converted 2 ANSI in View mode
// ^^^ [ Can`t be used on WWW ]
//++++++++++++++ E X A M P L E S ++++++++++++++++//
// FIRST SAMPLE:Sample Conversion
//
ASCIItoANSI ("PHP Power! => ");
/*
show: PHP Power! =>
but
really output is:
CrazyProg
rammer te
sting ASC
I 2 ANSI c
onversion
*/
ASCIItoANSI ("PHP Power! => ",1);
/*
show: PHP Powe
r! => 
but
really output is: &#80&#72&
#80&#32&#80&#111&#119
&#101&#114&#33&#32&
#61&#62&#32
*/
?>
<br><br>
<!-- MAIL PROTECT EXAMPLE (BASIC)-->
1 Sample
<a href="
<? ASCIItoANSI(
"mailto:codeguru@crazyprogrammer.cba.pl");?>"
>Mail me</a>
<!-- MAIL PROTECT EXAMPLE (ADVANCE)-->
2 Sample
<a href="
<? ASCIItoANSI(
"mailto:codeguru@crazyprogrammer.cba.pl?subject=php&body=question"
);?>"
><? ASCIItoANSI(
"codeguru@crazyprogrammer.cba.pl"
);?></a>
----
Server IP: 82.177.164.100
Probable Submitter: 81.210.63.146
----
Manual Page -- http://www.php.net/manual/en/function.bin2hex.php
Edit -- https://master.php.net/note/edit/80185
Del: integrated -- https://master.php.net/note/delete/80185/integrated
Del: useless -- https://master.php.net/note/delete/80185/useless
Del: bad code -- https://master.php.net/note/delete/80185/bad+code
Del: spam -- https://master.php.net/note/delete/80185/spam
Del: non-english -- https://master.php.net/note/delete/80185/non-english
Del: in docs -- https://master.php.net/note/delete/80185/in+docs
Del: other reasons-- https://master.php.net/note/delete/80185
Reject -- https://master.php.net/note/reject/80185
Search -- https://master.php.net/manage/user-notes.php