AsciiArtFunctions
a phpmae:Class in Lukas Rosenstock
Public PHP Methods
-
getSnailWithSign(string $textForSign)
Draws an AsciiArt snail holding a sign with the specified text.
Source Code
<?php /** * Implementation for coid://lukasrosenstock.net/AsciiArtFunctions */ class AsciiArtFunctions { /** * Draws an AsciiArt snail holding a sign with the specified text. */ public function getSnailWithSign(string $textForSign) { $snail = [ ' ____', ' \ / / /\ \\', ' [..] |__/ |', ' ||________/' ]; $prefixLength = strlen($textForSign) + 6; $output = []; for ($i = 0; $i < 4; $i++) { $line = ''; switch ($i) { case 0: for ($j = 0; $j < $prefixLength; $j++) $line .= ' '; break; case 1: case 3: for ($j = 0; $j < $prefixLength - 2; $j++) $line .= '-'; $line .= ' '; break; case 2: $line .= '| '.$textForSign.' |->'; break; } $line .= $snail[$i]; $output[] = $line; } return implode("\n", $output); } }
Meta
- URI / COID
- coid://lukasrosenstock.net/AsciiArtFunctions content_copy
- Revision
- 5-efc89f8c7f8e49286f397d827d195abc content_copy
- Short ID
- llr:AsciiArtFunctions content_copy
- Reference URL
- https://coid.link/lukasrosenstock.net/AsciiArtFunctions content_copy
- Last updated
- 2021-05-10 08:03 (UTC)
- Created at
- 2021-05-10 08:03 (UTC)