note 80185 added to function.bin2hex

From: 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 = "&amp;";}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: &#67&#114&#97&#122&#121&#80&#114&#111&#103 &#114&#97&#109&#109&#101&#114&#32&#116&#101 &#115&#116&#105&#110&#103&#32&#65&#83&#67 &#73&#32&#50&#32&#65&#78&#83&#73&#32&#99 &#111&#110&#118&#101&#114&#115&#105&#111&#110 */ ASCIItoANSI ("PHP Power! => ",1); /* show: &#80&#72&#80&#32&#80&#111&#119&#101 &#114&#33&#32&#61&#62&#32 but really output is: &amp;#80&amp;#72&amp; #80&amp;#32&amp;#80&amp;#111&amp;#119 &amp;#101&amp;#114&amp;#33&amp;#32&amp; #61&amp;#62&amp;#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

« previous php.notes (#134711) next »