與搜尋目標不分大小寫外,其他與str_replace相同。
將$subject
中的$search
部分用$replace
代換,並返回代換後的結果。$subject
可為字串或是字串陣列。
str_ireplace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) : mixed
search 搜尋目標,可以為一組陣列。
replace 置換內容,可以為一組陣列。
Example:
$test1 = "This is %user_name.";
print_r(str_ireplace("%user_name", "CyuBlog", $test1));
$test2 = array(
"Hi, this is %name",
"%name is a web blog"
);
print_r(str_ireplace("%Name", "CyuBlog", $test2));
$test3 = array(
"ABc",
"abc",
"Abc"
);
print_r(str_ireplace(array("a", "b", "c"), array("1" , "2", "3"), $test3));
Output:
// str_replace($test1):
This is CyuBlog.
// str_replace($test2):
Array
(
[0] => Hi, this is CyuBlog
[1] => CyuBlog is a web blog
)
// str_replace($test3):
Array
(
[0] => 123
[1] => 123
[2] => 123
)
Laravel8+Vue3+Bootstrap5實作TODO List ep09:安裝bootstrap5並美化todo list畫面
Laravel8+Vue3+Bootstrap5實作TODO List ep07:安裝vue3跟基本設定
Laravel8+Vue3+Bootstrap5實作TODO List ep08:用vue重新製作todo list畫面
Laravel8+Vue3+Bootstrap5實作TODO List ep06:初步認識Web Route
Laravel8+Vue3+Bootstrap5實作TODO List ep05:製作新增、更新、刪除待辦事項的API