运行 ❯
获取您自己的
PHP
服务器
×
更改方向
更改主题,深色/浅色
前往 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>
在数组中搜索值为 "RED" 的值,然后将其替换为 "pink"。
数组 ( [0] => blue [1] => pink [2] => green [3] => yellow )
替换次数:1