你好我想,雖然推動循環和數組,並把它推到我的新陣列。我目前正在此錯誤..陣推,預計參數
array_push()預計參數1是數組,字符串
我不明白爲什麼這不工作,我的代碼看起來是這樣的。
$data['text'] = array();
foreach($this->xml['paragraphs']['paragraph'] as $array)
{
array_push($array['text'], $data);
}
我的陣列
[paragraphs] => Array
(
[paragraph] => Array
(
[0] => Array
(
[text] => Solid wood door leading to entrance hallway, doors leading to Lounge/ Dining room and Shower room, double radiator, solid wood frame sash window to front, painted wood panell ceiling with single light, Indian slate floor.
)
[1] => Array
(
[text] => Solid wood frame sash window to front, double radiator, bathroom suite comrising: shower cubicle with obscure perspex panells, WC and vanity sink. Painted wood panel ceiling with single light. Heated towel rail,
)
你混了'$ data'和'$ array'? – deceze
爲什麼你避免這樣的簡單的解決方案:'$數據[] = $陣列[ '文本'];'? – Twisted1919
無我不是混合起來IM彈到陣列 – Brent