我想将数字一维数组中的数据添加到现有的一维总数组中,例如https://www.php.net/manual/de/function.array-push.php
我的解决方案创建了一个二维数组。我的逻辑错误在哪里?
.
.
$arr_Total_WordText=array();
$i=0;
while ($row = $result->fetch_assoc()) {
$text = utf8_encode(trim($row["mod_Thema"]));
...
$arrWordText[$i]=$text; // add several row-Infos
$i++;
array_push($arr_Total_WordText,$arrWordText);
}
print_r($arr_Total_WordText);
[0] => Array
(
[0] => eins
[2] => zwei
)
[1] => Array
(
[0] => Drei
[1] => vier
[2] => fünf
)
[2] => Array
(
[0] => sechs
[1] => sieben
[3] => acht
[4] => neun
)
PHP数组推送
函数式编程