如何将一堆不同长度的数组合并到一个线性数组中

时间:2018-10-23 17:07:44

标签: php arrays laravel

我有一些不同书籍的作者姓名,如下所示。有些有一个作者姓名,有些有两个和三个,依此类推。这是我的数组:(PHP,Laravel)

array:10 [▼
  0 => "["Yashavant P. Kanetkar"]"
  1 => "["Jordan Krause"]"
  2 => "["Christopher Negus","James","McKnight"]"
  3 => "["Richard Petersen"]"
  4 => "["Das", "Sumitabha"]"
  5 => "["Groff", "James"]"
  6 => "["Martin Reddy"]"
]

我想转换为此:

array:10 [▼
  0 => "["Yashavant P. Kanetkar"]"
  1 => "["Jordan Krause"]"
  2 => "["Christopher Negus"]"
  3 => "["James"]"
  4 => "["McKnight"]"
  5 => "["Richard Petersen"]"
  6 => "["Das"]"
  7 => "["Sumitabha"]"
  8 => "["Groff"]"
  9 => "["James"]"
  10 => "["Martin Reddy"]"
]

0 个答案:

没有答案