Search results

  1. J

    Randomly select a word from array

    I want to replace a word with its synonyms but I don't it to replace the word with the original word. (Like a spinner) This is the code that Zak_A from the forum helped me with: <?php $text = 'Honda is a truck.'; $array1 = array( 'sedan', 'coupe', 'truck' ); $replace1 =...
  2. J

    Str Replace multiple words once

    Okay so I want to replace 2 words with the same words in a different format but only once per occurance. <?php $text = "Word 1"; $newtext = str_replace(array('Word 1','Word 2'),'Word 1,Word 2',$text); echo $newtext . "<br>\n"; ?> This outputs: Word 1,Word 1,Word 2 I want it to instead out put...
Back
Top