Skip to content

Instantly share code, notes, and snippets.

@cereal-s
Created November 28, 2016 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cereal-s/5b560d139079f2409f2e9850f043e912 to your computer and use it in GitHub Desktop.
Save cereal-s/5b560d139079f2409f2e9850f043e912 to your computer and use it in GitHub Desktop.
ROT13 implementation with php://filter
<?php
/**
* ROT13 implementation with php://filter
*
* @see http://php.net/manual/en/wrappers.php.php
* @param string $message
* @return string
*/
function rot13_filter($message)
{
return file_get_contents("php://filter/string.rot13/resource=data:text/plain,{$message}");
}
$message = 'Hello Word';
$encode = rot13_filter($message);
$decode = rot13_filter($encode);
print "{$encode}\n{$decode}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment