Convert string to ASCII


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function to_ascii($string)
  2. {
  3. $ascii_string = '';
  4. foreach (str_split($string) as $char)
  5. {
  6. $ascii_string .= '&#' . ord($char) . ';';
  7. }
  8. return $ascii_string;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.