I'm trying to do a generator of typographic ornaments that will produce something like "{(©+Φ+©)}" every time is called. I have some strings with the characters for each side of the ornament that I converted to arrays using str_split(). My problem is that they appear with the infamous question mark icon � and sometimes I get the error "Undefined offset". Am I missing something? maybe with the UTF-8 encoding? --Thanks for any hint!
function ornamento() {
$izq = str_split("[{(]})");
$der = str_split("]})[{(");
$med = str_split("+÷×=#®©$%&?¿");
$cen = str_split("ΔΘЖΣΤΥΦΧΨΩ");
$idx1 = rand(1,sizeof($izq));
$idx2 = rand(1,sizeof($izq));
$mix1 = rand(1,sizeof($med));
$mix2 = rand(1,sizeof($med));
$cix = rand(1,sizeof($cen));
$ornamento = $izq[$idx1] . $izq[$idx2] . $med[$mix1] . $med[$mix2] . $cen[$cix] . $med[$mix2] . $med[$mix1] . $der[$idx2] . $der[$idx1];
echo $ornamento;
}