标签:替换 数组 hello 类型 [1] 返回值 ack 一个 search
str_replace($search,$replace,$subject):将$subject中的$search 都被$replace替换
此函数的入参可以是混合类型 mixed ,例如数组或字符串
返回值,返回一个字符串或数组。
例如:
//赋值:" <body text=‘black‘> " "<body text=‘%body%‘>"
str_replace("%body%","black","<body text=‘black‘>");
//赋值: "Hell Wrld f PHP" "Hello World of PHP"
str_replace(array(‘a‘,‘e‘,‘i‘,‘o‘,‘u‘,‘A‘,‘E‘,‘I‘,‘O‘,‘U‘),"","Hello World of PHP");
//赋值 ["Hello","World","of","PHP"] Array ( [0] => Hll [1] => Wrld [2] => f [3] => PHP )
str_replace(array(‘a‘,‘e‘,‘i‘,‘o‘,‘u‘,‘A‘,‘E‘,‘I‘,‘O‘,‘U‘),"",["Hello","World","of","PHP"]);
标签:替换 数组 hello 类型 [1] 返回值 ack 一个 search
原文地址:https://www.cnblogs.com/yanyanglaoyuan/p/10700790.html