Created
September 18, 2014 18:38
-
-
Save lelandbatey/f8e48b74165191511ca5 to your computer and use it in GitHub Desktop.
Like cowsay, but Tux, and in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tuxsay($str,$M=40){ | |
$W=strlen($str); | |
if($W>$M) $W=$M; | |
$tux_array=array(10,32,32,32,92,10,32,32,32,32,92,10,32,32,32,32,32,32,32,32,46,45,45,46,10,32,32,32,32,32,32,32,124,111,95,111,32,124,10,32,32,32,32,32,32,32,124,58,95,47,32,124,10,32,32,32,32,32,32,47,47,32,32,32,92,32,92,10,32,32,32,32,32,40,124,32,32,32,32,32,124,32,41,10,32,32,32,32,47,39,92,95,32,32,32,95,47,96,92,10,32,32,32,32,92,95,95,95,41,61,40,95,95,95,47,10); | |
$str=wordwrap($str,$W,"\n",1); | |
echo($str.implode(array_map(function($x){return chr($x);}, $tux_array)) ); | |
} | |
tuxsay("This is a testing thing that may or may not work."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment