Skip to content

Instantly share code, notes, and snippets.

@pce
Created December 11, 2011 13:59
Show Gist options
  • Save pce/1460749 to your computer and use it in GitHub Desktop.
Save pce/1460749 to your computer and use it in GitHub Desktop.
ascii map text-format read example
<?php
function asciimap_read($s)
{
$out = '';
$instructions = explode('|', $s);
foreach ($instructions as $instruction) {
$_ = explode(':', $instruction);
$count = $_[0];
$ascii = $_[1];
for ($i = 0;$i < $count; $i++)
$out .= chr($ascii);
}
return $out;
}
echo asciimap_read(
'2:32|1:79|3:45|1:79|1:10|1:32|1:47|1:32|1:92|1:32|1:47|1:32|1:92|1:10|1:79|3:45|1:79|3:45|1:79|1:10|1:32|1:92|1:32|1:47|1:32|1:92|1:32|1:47|1:10|2:32|1:79|3:45|1:79'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment