valore, chiave2->valore2", o $a = "valore1, valore2, valore3"; //VISUALIZZAZIONE function i_set_par ($OGGETTO) { //controllo se e' un array if (is_array($OGGETTO)) { return $OGGETTO; } else { $OGGETTO2 = explode(",",$OGGETTO); if(sizeof($OGGETTO2) > 1) { while(list($k, $v)=@each($OGGETTO2)) { $OUT = explode("->",$v); if(sizeof($OUT) > 1) { //Se torna qualcosa, allora torno l' array con chiave valore $chiave = trim($OUT[0]); $valore = trim($OUT[1]); $OUT2[$chiave] = "$valore"; } else { //siamo nel caso in cui non c'e' la chiave, la aggiungo $OUT2[] = trim($v); } } return $OUT2; } else { //E' una stringa controllo preseza parentesi //$OUT = ind_parentesi2($OGGETTO,"[","]"); //if($OUT != FALSE) { $OUT = explode("->",$v); if(sizeof($OUT) > 1) { //Se torna qualcosa, allora torno l' array con chiave valore $chiave = trim($OUT[0]); $valore = trim($OUT[1]); $OUT2[$chiave] = "$valore"; return $OUT2; } else { //siamo nel caso in cui non c'e' la chiave, la aggiungo $OUT[0] = trim($OGGETTO2[0]); return $OUT; } } } } //INDI2 (non usato) //ritorna un array con il testo fra parentesi e quello fuori dalle parentesi function ind_parentesi2($str, $start, $end) { $str_low = @trim(strtolower($str)); $pos_start = @strpos($str_low, $start); $pos_end = @strpos($str_low, $end, ($pos_start + strlen($start))); if ( ($pos_start !== false) && ($pos_end !== false) ) { $pos1 = $pos_start + strlen($start); $pos2 = $pos_end - $pos1; $OUT[chiave] = trim(@substr($str, $pos1, $pos2)); $OUT[valore] = trim(@substr($str, $pos_end+1, strlen($str))); return $OUT; } else return FALSE; } ?>