Location: PHPKode > scripts > CodeBreak - Hidden Morse Code > codebreak-hidden-morse-code/encode_text.inc.php
<?php
encode_letter_space();
for ($character_number = 0; $character_number < strlen($input_text); $character_number++) {
    $working_character = substr($input_text, $character_number, 1);
    if ($working_character == "A") {
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == "B") {
        encode_dash();
        encode_triple_dot();
    } elseif ($working_character == "C") {
        encode_dash();
        encode_single_dot();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "D") {
        encode_dash();
        encode_double_dot();
    } elseif ($working_character == "E") {
        encode_single_dot();
    } elseif ($working_character == "F") {
        encode_double_dot();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "G") {
        encode_dash();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "H") {
        encode_triple_dot();
        encode_single_dot();
    } elseif ($working_character == "I") {
        encode_double_dot();
    } elseif ($working_character == "J") {
        encode_single_dot();
        encode_dash();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "K") {
        encode_dash();
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == "L") {
        encode_single_dot();
        encode_dash();
        encode_double_dot();
    } elseif ($working_character == "M") {
        encode_dash();
        encode_dash();
    } elseif ($working_character == "N") {
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "O") {
        encode_dash();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "P") {
        encode_single_dot();
        encode_dash();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "Q") {
        encode_dash();
        encode_dash();
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == "R") {
        encode_single_dot();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "S") {
        encode_triple_dot();
    } elseif ($working_character == "T") {
        encode_dash();
    } elseif ($working_character == "U") {
        encode_double_dot();
        encode_dash();
    } elseif ($working_character == "V") {
        encode_triple_dot();
        encode_dash();
    } elseif ($working_character == "W") {
        encode_single_dot();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "X") {
        encode_dash();
        encode_double_dot();
        encode_dash();
    } elseif ($working_character == "Y") {
        encode_dash();
        encode_single_dot();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "Z") {
        encode_dash();
        encode_dash();
        encode_double_dot();
    } elseif ($working_character == "0") {
        encode_dash();
        encode_dash();
        encode_dash();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "1") {
        encode_single_dot();
        encode_dash();
        encode_dash();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "2") {
        encode_double_dot();
        encode_dash();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "3") {
        encode_triple_dot();
        encode_dash();
        encode_dash();
    } elseif ($working_character == "4") {
        encode_triple_dot();
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == "5") {
        encode_triple_dot();
        encode_double_dot();
    } elseif ($working_character == "6") {
        encode_dash();
        encode_triple_dot();
        encode_single_dot();
    } elseif ($working_character == "7") {
        encode_dash();
        encode_dash();
        encode_triple_dot();
    } elseif ($working_character == "8") {
        encode_dash();
        encode_dash();
        encode_dash();
        encode_double_dot();
    } elseif ($working_character == "9") {
        encode_dash();
        encode_dash();
        encode_dash();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == ".") {
        encode_single_dot();
        encode_dash();
        encode_single_dot();
        encode_dash();
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == ",") {
        encode_dash();
        encode_dash();
        encode_double_dot();
        encode_dash();
        encode_dash();
    } elseif ($working_character == ":") {
        encode_dash();
        encode_dash();
        encode_dash();
        encode_triple_dot();
    } elseif ($working_character == "?") {
        encode_double_dot();
        encode_dash();
        encode_dash();
        encode_double_dot();
    } elseif ($working_character == "'") {
        encode_single_dot();
        encode_dash();
        encode_dash();
        encode_dash();
        encode_dash();
        encode_single_dot();
    } elseif ($working_character == "-") {
        encode_dash();
        encode_triple_dot();
        encode_single_dot();
        encode_dash();
    } elseif ($working_character == " ") {
        encode_word_space();
    }
    encode_letter_space();
    encode_letter_space();
}
?>
Return current item: CodeBreak - Hidden Morse Code