Run ❯
Get your
own PHP
server
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <p>Search an array for the value "RED", and then replace it with "pink".</p> <?php $arr = array("blue","red","green","yellow"); print_r(str_ireplace("RED","pink",$arr,$i)); // Case-insensitive echo "<br>" . "Replacements: $i"; ?> </body> </html>
Search an array for the value "RED", and then replace it with "pink".
Array ( [0] => blue [1] => pink [2] => green [3] => yellow )
Replacements: 1