<?php

function pixelPrint($text) {
    $maps = [
        'a' =>
        [
            0, 1, 1, 1, 0,
            1, 0, 0, 0, 1,
            1, 1, 1, 1, 1,
            1, 0, 0, 0, 1,
            1, 0, 0, 0, 1,
        ],
        'b' =>
        [
            1, 1, 1, 1, 0,
            1, 0, 0, 0, 1,
            1, 1, 1, 1, 1,
            1, 0, 0, 0, 1,
            1, 1, 1, 1, 0,
        ],
        'c' =>
        [
            0, 1, 1, 1, 1,
            1, 0, 0, 0, 0,
            1, 0, 0, 0, 0,
            1, 0, 0, 0, 0,
            0, 1, 1, 1, 1,
        ],
        'e' =>
        [
            1, 1, 1, 1, 1,
            1, 0, 0, 0, 0,
            1, 1, 1, 1, 0,
            1, 0, 0, 0, 0,
            1, 1, 1, 1, 1,
        ],
        'l' =>
        [
            1, 0, 0, 0, 0,
            1, 0, 0, 0, 0,
            1, 0, 0, 0, 0,
            1, 0, 0, 0, 0,
            1, 1, 1, 1, 1,
        ],
        'u' =>
        [
            1, 0, 0, 0, 1,
            1, 0, 0, 0, 1,
            1, 0, 0, 0, 1,
            1, 0, 0, 0, 1,
            0, 1, 1, 1, 0,
        ],
        'y' =>
        [
            1, 0, 0, 0, 1,
            0, 1, 0, 1, 0,
            0, 0, 1, 0, 0,
            0, 0, 1, 0, 0,
            0, 0, 1, 0, 0,
        ],
    ];
    for ($i = 0;$i < 5;$i++) {
        echo '▏';
        for ($j = 0;$j < strlen($text);$j++) {
            $char = $text[$j];
            for ($k = 0;$k < 5;$k++) {
                $v = $maps[$char][$i*5+$k];
                echo $v?'⿴':' ';
            }
            echo ' ';
        }
        echo "\n";
    }
    echo "\n";
}

//pixelPrint('abc');
echo "\n";
echo "\n";
//pixelPrint('yuulye');

// box-drawing characters
$boxes = [
    "┌", "┐",
    "│", "─",
    "└", "┘",
];

// ideographic characters
$boxes = [
    //"㇑", "㇐",
    "⿰", "⿱",
];

$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'?";
$circled = "ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓠⓨⓩⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓆⓎⓏ";
$circledNeg = "🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅠🅨🅩🅐🅑🅒🅓🅔🅕🅖🅗🅘🅙🅚🅛🅜🅝🅞🅟🅠🅡🅢🅣🅤🅥🅦🅠🅨🅩";
$full = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,',?";
$squared = "🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅀🅈🅉🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅀🅈🅉";
$squaredNeg = "🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆀🆈🆉🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆀🆈🆉";


$content = [
    " I"," m"," a"," g"," i"," n"," a"," t"," i"," o"," n","  ","  ",
    " i"," s","  "," m"," o"," r"," e","  ","  ","  ","  ","  ","  ",
    " i"," m"," p"," o"," r"," t"," a"," n"," t","  ","  ","  ","  ",
    " t"," h"," a"," n","  ","  ","  ","  ","  ","  ","  ","  ","  ",
    " k"," n"," o"," w"," l"," e"," d"," g"," e","  ","  ","  ","  ",
    "  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ",
    "  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ","  ",
];

$text = "Imagination is more important than knowledge";

$lines = explode(" ", $text);
$lines = [
    " ",
    "  what's",
    " happening ",
];

$w = 13;
$h = 6;
$l = $w - 2;

$maps = array_flip(str_split($chars));
$full = explode(",", $full);

$k = 0;
for ($i = 0;$i < $h;$i++) {
    $l = 0;
    for ($j = 0;$j < $w;$j++) {
        if ($i===0 or $i===$h-1) echo $boxes[1];
        elseif ($j===0 or $j===$w-1) echo $boxes[0];
        else {
            $char = $lines[$k][$l];
            $id = @$maps[$char];
            if ($id !== NULL) {
                echo $full[$id];
            }
            else echo ' ';
            $l++;
        }
    }
    if (($i!==0 or $i!==$h-1) and $l > 0) $k++;
    echo "\n";
}

echo "\n";