Nommiin icon

nommlang - php

Nommiin | PRO | 02/25/17 05:08:49 AM UTC | 0 ⭐ | 291 👁️ | Never ⏰ | []
PHP |

610 B

|

None

|

0 👍

/

0 👎

function runNommlang($input) {
    $canPrint = false;
    $charIndex = 0;
    for($i = 0; $i < strlen($input); $i++) {
        switch (strtolower(substr($input, $i, 1))) {
            case "n": {
                echo "\n";
            break;}
            case "o": {
                $canPrint = true;
            break;}
            case "m": {
                $charIndex++;
            break;}
            case " ": {
                if ($canPrint == true) {
                    echo chr(64 + $charIndex);
                    $charIndex = 0;
                }
            break;}
        }
    }
}

Comments