so i have an array with months:
$arr_month = array(
1=>'january',
2=>'february',
3=>'march',
4=>'april',
5=>'may',
6=>'june',
7=>'july',
8=>'august',
9=>'september',
10=>'october',
11=>'november',
12=>'december'
);
i also have strings (i know, they look weird…) that look like:
23 de january del 2003
12 de may de 1976
6 de february de 1987
What i want is to find and match the month in the string with the array and return the array key.
so:
23 de january del 2003 returns 1
12 de may de 1976 returns 5
6 de february de 1987 returns 2
and so on…
Any idea how?
This should work for you.
yields
1.See http://php.net/manual/en/function.array-search.php for more.