数组的最后一个元素

我试图通过数组来创建一个新的数组。尝试在运行此代码时记录所有内容:


$this->writeToLog(print_r($this->assembledText, true), 'ass.log');

foreach ($this->assembledText as $paragraphsKey => $paragraphs) {

    $this->writeToLog("Paragraph Key:".$paragraphsKey.print_r($paragraphs, true), 'para.log'); 

    $i = 0;

    foreach ($paragraphs as $words) {

        $newText[$paragraphsKey][$i] = $words;

        $i++;

    }

}

在我完成之前,我在这里记录了文本,以及到目前为止我所拥有的:


ass.log 给了我这个:


[2019-05-18 20:32:38] Array

(

    [0] => Array

        (

            [0] => One

            [1] => thing

            [2] => was

            [3] => certain,

            [4] => that

            [5] => the

            [6] => white

            [7] => kitten

            [8] => had

            [9] => had

            [10] => nothing

            [11] => to

            [12] => do

            [13] => with

            [14] => it:

            [15] => —

            [16] => it

            [17] => was

            [18] => the

            [19] => black

            [20] => kitten’s

            [21] => fault

            [22] => entirely.

            [23] => For

            [24] => the

            [25] => white

            [26] => kitten

            [27] => had

            [28] => been

            [29] => having

            [30] => its

            [31] => face

            [32] => washed

            [33] => by

            [34] => the

            [35] => old

            [36] => cat

        )


)

有什么建议么?


GCT1015
浏览 118回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP