I am trying an array of considerable size with some data that I would like to group.
This would be an example of the array:
[24] => Array
(
[0] => /03-19_solemnidad-de-san-jose-homilias/
[1] => 53
)
[25] => Array
(
[0] => /03-19_solemnidad__san-jose_homilias/
[1] => 1
)
[26] => Array
(
[0] => /03-19_solemnidad_san-jose-esposo-de-la-bienaventurada-virgen-maria_homilias/
[1] => 970
)
[27] => Array
(
[0] => /03-19_solemnidad_san-jose_homilias/
[1] => 1622
)
[26] => Array
(
[0] => /03-19_solemnidad_san-jose_homilias/
[1] => 14
)
[150] => Array
(
[0] => /19-03_solemnidad_san-jose_homilias/
[1] => 1
)
[151] => Array
(
[0] => /19-03_solemninad_san-jose_homilias/
[1] => 1
)
[152] => Array
(
[0] => /19-3_solemninad_san-jose_homilias/
[1] => 2
)
In this case I want all the indexes 0
indicated here, to acquire this unique value:
/03-19_solemnidad_san-jose-esposo-de-la-bienaventurada-virgen-maria_homilias/
to then apply another code that I already have that removes duplicates, adding the value of the index 1
to the only value that will remain.
To match all the index values 0
I'm doing it one by one:
$row[0]=str_replace('/03-19_solemnidad-de-san-jose-homilias/', '/03-19_solemnidad_san-jose-esposo-de-la-bienaventurada-virgen-maria_homilias/', $row[0]);
$row[0]=str_replace('/03-19_solemnidad__san-jose_homilias/', '/03-19_solemnidad_san-jose-esposo-de-la-bienaventurada-virgen-maria_homilias/', $row[0]);
...
What I want to know is if there is any way to optimize the replacement. For example, creating an array or something, in which the final value is found and the values to be searched / replaced, instead of doing it one by one.