Why not just use str_replace without a loop?
$array = array('foobar', 'foobaz');
$out = str_replace('foo', 'hello', $array);
More Related Contents:
- PHP string replace match whole word
- Search and replace multiple values with multiple/different values in PHP5?
- str_replace with array
- Search and replace multiple values with multiple/different values in PHP?
- Simple: How to replace “all between” with php? [duplicate]
- How to get the first key of many duplicated json key? [duplicate]
- How can I access an array/object?
- PHP syntax for dereferencing function result
- How to filter an array by a condition
- Access array returned by a function in php
- Are arrays in PHP copied as value or as reference to new variables, and when passed to functions?
- PHP Multiple Checkbox Array
- What is so wrong with extract()?
- PHP explode the string, but treat words in quotes as a single word
- How to re-index the values of an array in PHP? [duplicate]
- PHP Difference between array() and []
- filter values from an array similar to SQL LIKE ‘%search%’ using PHP
- Type hinting – specify an array of objects
- Convert all types of smart quotes with PHP
- Check if string contains a value in array [duplicate]
- CSV to Associative Array
- How to pass an array via $_GET in php?
- How to create an empty array in PHP with predefined size?
- Merge multiple associative arrays and add missing columns with a default value
- Find common values in multiple arrays with PHP
- Add elements to array which has gapped numeric keys to form an indexed array / list
- Return only duplicated entries from an array (case-insensitive)
- PHP remove commas from numeric strings
- PHP: Check for duplicate values in a multidimensional array
- array_diff to compare two associative arrays