PHP Single-Character Substitutions – String Function

<?php
  $qwerty = 'qwertyuiopasdfghjklzxcvbnm' . 'QWERTYUIOPASDFGHJKLZXCVBNM';
  $dvorak = 'abcdefghijklmnopqrstuvwxyz' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  $message = "Start the attack when the sun rises.";
  $encoded = strtr($message, $qwerty, $dvorak);
  $decoded = strtr($encoded, $dvorak, $qwerty);
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.