x
 
<!DOCTYPE html>
<html>
<body>
<p>在数组中搜索值 "RED",然后将其替换为 "pink"。</p>
<?php
$arr = array("blue","red","green","yellow");
print_r(str_replace("red","pink",$arr,$i));
echo "<br>" . "替换次数: $i";
?>
</body>
</html>