Frank Schneider Posted December 23, 2021 Share Posted December 23, 2021 i have a string as follows $content='<h2>asdfgjklöä</h2>Familienname xName'; and i want replace xName but i cannot find any function. Is there a way like c# replace? 1 Link to comment Share on other sites More sharing options...
Jan Romero Posted December 23, 2021 Share Posted December 23, 2021 Welcome to PHP lol https://www.php.net/manual/function.preg-replace.phphttps://www.php.net/manual/function.str-ireplace.phphttps://www.php.net/manual/function.str-replace.phphttps://www.php.net/manual/function.mb-ereg-replace.php (just use this)https://www.php.net/manual/function.mb-eregi-replace.php (or this)https://www.php.net/manual/function.mb-ereg-replace-callback.phphttps://www.php.net/manual/function.substr-replace.phphttps://www.php.net/manual/function.preg-replace-callback.phphttps://www.php.net/manual/function.preg-replace-callback-array.php 2 1 Link to comment Share on other sites More sharing options...
Clarity Posted January 16, 2022 Share Posted January 16, 2022 Hello, @Frank Schneider! The code is: $content = str_replace('xName', 'something', $content); Have a nice day! 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now