replace array elements with highlighted text in a text
Posted: Wed Dec 05, 2007 4:00 am
hi,
i am trying to replace elements of an array in a text with their bold equivalent.
For example
i have this array
i have a text
lorem ipsum name5 lorem ipsum name2 lorem ipsum dolor name9
i want name5, name2 and name9 to be highlighted with some background color.
problem is what this is going to be time consuming if the array contains around 6000 elements i have to loop through each element and highlight the text if match is found.
Thanks in advance
i am trying to replace elements of an array in a text with their bold equivalent.
For example
i have this array
Code: Select all
$arr=Array('name1','name2','name3','name4','name5','name6','name7','name8','name9');lorem ipsum name5 lorem ipsum name2 lorem ipsum dolor name9
i want name5, name2 and name9 to be highlighted with some background color.
problem is what this is going to be time consuming if the array contains around 6000 elements i have to loop through each element and highlight the text if match is found.
Thanks in advance