Fatal error: Cannot use [] for reading in /Users/user1/Documents...
And if I remove the first then PHP complains…
Notice: Undefined index: pattern in /Users/user1/Documents...
Warning: preg_replace(): Empty regular expression in /Users/user1/Documents...
I got things working with a one-dimensional array, but it would be nice to get the above code working so I can use one multidimensional array for several things in my function.
you know what array you have built from your DB query, you know (and if you don’t, read it up in the manual) what array preg_replace() expects. hence, transform array 1 into array 2.
hm, what array element should $badWordsArray[] return to you?
Sorry, but I don’t see how the function or your response helps where I am stuck…
I have a multidimensional array which contains bad words, but it seems that preg_replace only wants $patterns in a one-dimensional array.
I fail to see how array_map would help here.
The first thing I need to know is whether I can coax preg_replace into accepting bad words from my multidimensional array, or if I have to ditch it and create a one-dimesnional array as a compromise.
As it stands, $badWordsArray returns an array of arrays about bad words (i.e. metadata)