我有两个变量,这种结构:合并两个数组并限定所有其他与符号(=)
$columns = "col1, col2, col3";
$values = "$value1, $value2, $value3";
什么我需要做的就是:
$combined = "col1 = $value1, col2 = $value2, col3 = $value3";
我敢肯定我需要:
explode(',', $columns);
explode (',', $values);
$combined = array_combine($columns, $values);
$combined = implode(',', $combined);
但当时我只是得到:
$combined = "col1, $value1, col2, $value2, col3, $value3";
如何将每个逗号替换为“=”?
这是最好的方式去做这件事吗?
,让COL1 = $值1 = col2 =等... – Edward 2013-05-10 14:57:53
,就像它不见了哈哈。 – Edward 2013-05-10 14:58:32
大声笑,对不起,我回答太快,然后我意识到我错了:) – HamZa 2013-05-10 14:59:24