Hy to all, basicly all I want to do is:
I have an array of three elements, the firt to elements can be a string or a number for example.
vect[0]=12, vect[1]=JULY, or vect[0]=first,vect[1]=2 and so on.
all I want to do is to change the array value in base of it value. so if vect[0]=first I want to substitute it with 1, and if vect[1]=JULY I want to substitute it with 7. The only solution I can think of is to make a series of IF's but I don't like it, I think there is a bettere way to do it.
this is my script
$date = "riunione del 1/aprile/1969 orco zio";
$p="!(primo|due|tre|quattro|cinque|sei|sette|otto|nove|dieci|undici|dodici|tredici|quattordici|quindici|sedici|diciassette|diciotto|diciannove|venti|ventuno|ventidue|ventitre|ventitrĂ©|ventitrè|ventiquattro|venticinque|ventisei|ventisette|ventotto|ventinove|trenta|trentuno|PRIMO|DUE|TRE|QUATTRO|CINQUE|SEI|SETTE|OTTO|NOVE|DIECI|UNDICI|DODICI|TREDICI|QUATTORDICI|QUINDICI|SEDICI|DICIASSETTE|DICIOTTO|DICIANNOVE|VENTI|VENTUNO|VENTIDUE|VENTITRE|VENTITRÉ|VENTITRĂˆ|VENTIQUATTRO|VENTICINQUE|VENTISEI|VENTISETTE|VENTOTTO|VENTINOVE|TRENTA|TRENTUNO|\d(?:\d)?)[-/](GENNAIO|FEBBRAIO|MARZO|APRILE|MAGGIO|GIUGNO|LUGLIO|AGOSTO|SETTEMBRE|OTTOBRE|NOVEMBRE|DICEMBRE|gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre|[0-9])[-/](\d\d(?:\d\d)?)*!";
if (preg_match($p,$date,$matches)) {
echo $matches[1];
echo $matches[2];
echo $matches[3];
}
some has some ideas?
thank's