執行 ❯
獲取您
自己的 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_replace("red","pink",$arr,$i)); echo "<br>" . "Replacements: $i"; ?> </body> </html>
在陣列中搜索值“RED”,然後將其替換為“pink”。
陣列 ( [0] => blue [1] => pink [2] => green [3] => yellow )
替換次數: 1