Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP数组到字符串问题_Php_Arrays - Fatal编程技术网

PHP数组到字符串问题

PHP数组到字符串问题,php,arrays,Php,Arrays,您好,我在PHP中有一个数组,当我打印它时,它是这样的: ["Testing","Test2","New Testing Activity","The last five letters in the alphabet"] {"Testing","Test2","New Testing Activity","The last five letters in the alphabet"} 有没有一种方法可以使数组变成这样: ["Testing","Test2","New Testing Act

您好,我在PHP中有一个数组,当我打印它时,它是这样的:

["Testing","Test2","New Testing Activity","The last five letters in the alphabet"]
{"Testing","Test2","New Testing Activity","The last five letters in the alphabet"}
有没有一种方法可以使数组变成这样:

["Testing","Test2","New Testing Activity","The last five letters in the alphabet"]
{"Testing","Test2","New Testing Activity","The last five letters in the alphabet"}
我要这个“{”而不是“[”

谢谢

也许你想做:

echo '{"' . implode('","', $arr) . '"}';

演示:

这不是PHP中的数组结构。请向我们展示您的代码,并告诉我们您想做什么来解决您的问题。这正是我所做的!干得好,@qwertynl!