Home >Backend Development >PHP Tutorial >如何把数组变成带单引号的字符串?
$a = array(2,3,4);
数组$a如何 转变为结果为‘2’,‘3’,‘4’ 的字符串, 谢谢!
$a = array(2,3,4);foreach($a as &$v) $v = "'$v'";print_r($a);
$a = array(2,3,4);$s = "'" . join("','", $a) . "'";echo $s;'2','3','4'