Skip to content

Instantly share code, notes, and snippets.

@joglr
Created December 20, 2013 20:27
Show Gist options
  • Save joglr/8060932 to your computer and use it in GitHub Desktop.
Save joglr/8060932 to your computer and use it in GitHub Desktop.
Minecraft chat message colorfier.
<?php
$str = $_GET['string'];
$str = explode(' ', $str);
$colors = array('a', 'b', 'c', 'd', 'e', '1', '2', '3', '4', '5', '6', '7', '8', '9');
foreach($str as $key => $value) {
$color = $colors[rand(0, count($colors)-1)];
$str[$key] = utf8_decode('§').$color.$value;
}
$str = join(' ', $str);
?>
<meta chartset="UTF-8" />
<style>
body {
font-family: Helvetica, Arial, Verdana, sans-serif;
}
</style>
<form method="get">
<output>
<div>Input: <input type="text" name="string" value="<?php echo $_GET['string']; ?>" /><input type="submit" /></div>
<div>Output: <input type="text" value="<?php echo $str; ?>" /></div>
</output>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment