Skip to content

Instantly share code, notes, and snippets.

@flyte
Created January 10, 2014 12:37
Show Gist options
  • Save flyte/8351230 to your computer and use it in GitHub Desktop.
Save flyte/8351230 to your computer and use it in GitHub Desktop.
Generate QR code contents in PHP.
<?php
function toQRCode($prefix, $str) {
$prefixOrd = "";
for ($i = 0; $i < strlen($prefix); $i++) {
$c = substr($prefix, $i, 1);
$prefixOrd.= dechex(ord($c));
}
return $prefixOrd.md5($str);
}
echo toQRCode("ABC", "Hello World!")."\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment