<?php
function text2bin($txt_str)
{
    $len = STRLEN($txt_str);
    $bin = '';
    FOR($i = 0; $i < $len; $i  )
    {
        $bin .= STRLEN(DECBIN(ORD($txt_str[$i]))) < 8 ? STR_PAD(DECBIN(ORD($txt_str[$i])), 8, 0, STR_PAD_LEFT) : DECBIN(ORD($txt_str[$i]));
    }
    RETURN $bin;
}
$txt_str = "I am here";
echo text2bin($txt_str);
?>