'·-','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'=>'--··'); var $numbers=array(1=>'·----',2=>'··---',3=>'···--',4=>'····-',5=>'·····',6=>'-····',7=>'--···',8=>'---··',9=>'----·',0=>'-----'); function ToMorse($text) { $text=strtolower($text); trim($text); $k=strlen($text); for ($i=0;$i<$k;$i++) { $t=substr($text,$i,1); if ($t==" ") { $out.="
"; } elseif (array_key_exists($t, $this->letters)) { $out.=" ".$this->letters[$t]." "; } elseif (array_key_exists($t, $this->numbers)) { $out.=" ".$this->numbers[$t]." "; } } DEFINE("MORSE", $out); } function ToText($morse) { $letters = array_flip ($this->letters); $numbers = array_flip ($this->numbers); trim($morse); $arr=explode("
",$morse); $k=count($arr); for ($i=0;$i<$k;$i++) { $obj[$i]=explode(" ",$arr[$i]); for ($j=0;$jToMorse($text); $new->ToText(MORSE); echo TEXT." en morse ca s'ecrit :
".MORSE."
"; ?>