PHPでhello world

コンピュータ
VScodeのデバッグでコンソール出力
<?php
    $data = array(
        '0' => array(1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1),
        '1' => array(1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1),
        '2' => array(1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1),
        '3' => array(1,1,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1),
        '4' => array(1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1),
        '5' => array(1,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1),
        '6' => array(1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1),
        '7' => array(1,0,0,1,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,0,2,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1)
    );
    define("ON_CHAR", "N");
    define("OFF_CHAR", " ");
    define("NG_CHAR", "*");

    echo("\n");
    foreach ($data as $key => $value) {
        $n = intval($key)+1;
        $line = "";
        for ($i=0; $i < count($value); $i++) {
            if ($value[$i] == 0) {
                $line = $line . OFF_CHAR;
                continue;
            }
            if ($value[$i] == 1) {
                $line = $line . ON_CHAR;
                continue;
            }
            $line = $line . NG_CHAR;
        }
        echo(sprintf("%02d  %s\n", $n, $line));
    }

    echo("\n");
?>

コメント