Input replace is a PHP function used to replace characters or strings in an input value with another character or string. This is useful in applications where users enter data that needs to be sanitized or reformatted.
Example 1: Replace all occurrences of "apple" with "orange" in user input
$input = "I love apples. Apples are the best!"; $output = str_replace("apple", "orange", $input); echo $output;
Output: "I love oranges. Oranges are the best!"
Example 2: Remove all non-numeric characters from user input
The function used in the examples is not part of a package or library, it is a built-in PHP function.
PHP Input::replace - 30 examples found. These are the top rated real world PHP examples of Input::replace extracted from open source projects. You can rate examples to help us improve the quality of examples.