This question has already been answered:
From this text "[id120080895 | Lesch, hello!" I do such a "Lesha, hello!" The following code:
$txt = $result['text']; $arrgumentstxt = array('[',']','|','id',1,2,3,4,5,6,7,8,9,0); $formattxt = str_ireplace($arrgumentstxt, '', $txt); echo $formattxt; However, if the source text is in this format "[id120080895 | Lesha], hello! Here is his number +79789879878" , then the output is truncated number , and any other numbers.
How to cut exactly [id120080895 | Lesha], leave the name, but do not touch anything else, for example, if there are numbers in the text.