Snippets tagged “str-replace”
9 snippets use this tag.
- Converting <br> into a new line for use in a text areaPHP
In PHP, you can use the nl2br() function to convert line breaks (\n or \r\n) to <br> tags.
- Delete particular word from stringPHP
In PHP, you can use the str_replace function to delete a particular word from a string.
- How can I remove part of a string in PHP?PHP
There are several ways to remove a portion of a string in PHP.
- How to remove backslash on json_encode() function?PHP
You can use the JSON_UNESCAPED_SLASHES option in the json_encode() function to prevent backslashes from being added to the JSON string.
- How to remove line breaks (no characters!) from the string?PHP
There are a few different ways to remove line breaks from a string in PHP. Here are two options.
- How to Replace a Word Inside a PHP StringPHP
Sometimes, it is necessary to replace a given word inside a string in PHP. Here, we will consider three helpful functions that help to carry out the task.
- How to Strip all Spaces out of a String in PHPPHP
If you want to get the best solution to how to strip all spaces out of a string in PHP, you are in the right place. Read the snippet and choose your option.
- Remove control characters from PHP stringPHP
In PHP, you can use the preg_replace function to remove control characters from a string.
- Remove new lines from string and replace with one empty spacePHP
To remove new lines from a string and replace them with a single empty space in PHP, you can use the str_replace function.