Multiple replace (probably preg_replace) of same string with array

前端 未结 2 760
别那么骄傲
别那么骄傲 2021-01-16 04:06

I need to replace multiple instances of a certain string (question mark) with strings from an array. e.g. if the string I wish to replace appears 3 times and my array has a

2条回答
  •  伪装坚强ぢ
    2021-01-16 05:03

    why not use

    $retString = vsprintf('banana is %s, apple is %s, tomato is %s', $myArray);  
    return $retString;
    

提交回复
热议问题