Text_Figlet
[ class tree: Text_Figlet ] [ index: Text_Figlet ] [ all elements ]

Source for file hello_world.php

Documentation is available at hello_world.php

  1. <?php
  2.  
  3. /* UTF-8 convert to FIGlet Unicode */
  4. /* iconv PHP module required */
  5. function utf8tofiglet($str)
  6. {
  7.     // escape %u
  8.     $str str_replace('%u'sprintf('%%%%u%04X'ord('u'))$str);
  9.  
  10.     if (function_exists('iconv')) {
  11.         $str iconv('utf-8''ucs-2be'$str);
  12.         $out '';
  13.  
  14.         for ($i = 0$len strlen($str)$i<$len$i++{
  15.             $code ord($str[$i++]* 256 + ord($str[$i]);
  16.  
  17.             $out .= $code < 128 ? $str[$isprintf('%%u%04X'$code);
  18.         }
  19.  
  20.         return $out;
  21.     }
  22.  
  23.     return $str;
  24. }
  25.  
  26. require_once 'Text/Figlet.php';
  27.  
  28. $figlet = new Text_Figlet();
  29. $error  $figlet->LoadFont('makisupa.flf');
  30. if (PEAR::isError($error)) {
  31.     echo 'Error: ' $error->getMessage("\n";
  32. else {
  33.     echo $figlet->LineEcho(utf8tofiglet('Hello, world!')) "\n";
  34. }
  35. ?>

Documentation generated on Mon, 11 Mar 2019 15:37:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.