1
假設我有一組字符串,其中包含一個字符的分隔符,如何將它作爲數組添加到數組中?將數組添加到數組PHP
private fileTextHeaders = array();
public function addHeaders($longStringHeaders){
$parts = explode("@", $longStringHeaders);
foreach ($parts as $part){
$this->fileTextHeaders[] = $part;
}
print_r($this->fileTextHeaders);
}
我有下面的代碼,但結果是
addHeaders("[email protected]@no");
array ([0]=>test, [1]=>yes, [2]=no)
我的目標是
array(
array(test),
array(yes),
array(no)
)
喔完蛋了?非常感謝你! – Led