-1

Actually I want to convert all the special characters into their codes as I've shown below:

!   !    
"   " 
#   #    
$   $    
%   %    
&   & 
'   '    
(   (    
)   )    
*   *    
+   +    
,   ,    
-   -    
.   .    
/   /

Is there any way to convert them into respected codes in php.

Manish Jangir
  • 131
  • 1
  • 3
  • 10

2 Answers2

-1

There are functions called html_entity_decode and htmlentities in PHP.

sashkello
  • 17,306
  • 24
  • 81
  • 109
  • Mate, just go here and check yourself: http://php.net/manual/en/function.htmlentities.php There are different ways to encode things, find the particular one you want. – sashkello Dec 07 '12 at 06:53
  • There's also htmlspecialchars which may be closer to your goal. – sashkello Dec 07 '12 at 06:54
-1
 $str="&#33";
 echo html_entity_decode($str); //output !
sandipon
  • 986
  • 1
  • 6
  • 19