Answer the question
In order to leave comments, you need to log in
How to come up with an algorithm - to replace words in HTML with synonyms from an array at each occurrence?
I can not figure out how to make a replacement in the HTML code of the page.
There is an array with words (there will be about 1k arrays, each with 3-50 elements) ['rain ', 'rainfall', 'storm']
It is necessary that the occurrence of each of these words in the text be replaced by any other from the array, in the text any of the words in the array can occur 0-N times. At the same time, not all N occurrences of the word rain should be replaced by storm
, but in random order with rainfall
, and other options (if any).
Option 1:
str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) : mixed
"spintax" {rain|clown|snow}
. Answer the question
In order to leave comments, you need to log in
you think google naeepat? he spun such smart ones on the patent
on the subject: with
the first pass you change what you are looking for for SERVICE
, the second you form an array of replacements (clean in a simple way, but you can also use it for an adult, with cases) with the
third you change SERVICE for array elements
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question