我有一个类似于下面示例的数组,但要大得多(4000 行长):
array(
"id" => array(
"a" => "",
"b" => "",
"c" => Needs Quotes Around Me
), "id" => array(
"a" => "",
"b" => "",
"c" => Needs Quotes Around Me
"d" => Needs Quotes Around Me
)
);
出于某种原因,字符串值没有引号 ("") 和冒号分隔符。有些字符串是数字,但可以被视为字符串,有些有空格和@符号,因为有些是电子邮件地址,但我需要将它们全部包装起来"STRING HERE",
我试图将 reg_replace 与这样的东西一起使用,=>\s([a-zA-Z0-9\@\s])+$
但它不会用它找到的字符串替换匹配的字符串?我已经做了很多谷歌搜索,但似乎无法正确,请告诉我我哪里出错了。
我最终得到的是:
array(
"id" => array(
"a" => "",
"b" => "",
"c" => "[a-zA-Z0-9\@\s]",
), "id" => array(
"a" => "",
"b" => "",
"c" => "[a-zA-Z0-9\@\s]",
"d" => "[a-zA-Z0-9\@\s]",
)
);