Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 他们是否有任何方法来循环数组&;的数据;从中创建另一个数组?_Php_Arrays - Fatal编程技术网

Php 他们是否有任何方法来循环数组&;的数据;从中创建另一个数组?

Php 他们是否有任何方法来循环数组&;的数据;从中创建另一个数组?,php,arrays,Php,Arrays,我正在尝试从此输入创建数组: Array ( [0] => stdClass Object ( [id] => 85 [time] => 2020-07-18 13:34:59 [user] => 32 [status] => read [type] => profile_view [content] => One has viewed your pr

我正在尝试从此输入创建数组:

Array (
    [0] => stdClass Object (
        [id] => 85
        [time] => 2020-07-18 13:34:59
        [user] => 32
        [status] => read
        [type] => profile_view
        [content] => One has viewed your profile. 
    )
    [1] => stdClass Object (
        [id] => 79
        [time] => 2020-07-20 12:16:03
        [user] => 32
        [status] => read
        [type] => profile_view
        [content] => test buyer has viewed your profile.
    )
    [2] => stdClass Object (
        [id] => 76
        [time] => 2020-07-20 12:59:11
        [user] => 32
        [status] => read
        [type] => profile_view_guest
        [url] => 
        [content] => A guest has viewed your profile.
    )
)
要输出:

Array (
    [0] => Array (
        [label] => July 18 2020
        [y] => 1
    )
    [1] => Array (
        [label] => July 20 2020
        [y] => 1
    )
    [2] => Array (
        [label] => July 20 2020
        [y] => 1
    )
)

此处
[y]
将显示输入的日期在此重复的次数。

请参见下面的示例


请去阅读。这不是一个总是问基本“怎么做”问题的地方。首先,您应该显示您尝试的内容。此外,请格式化您显示的代码,并引入一些换行符,这样我们就不必横向滚动五英里来查看您的实际数据。请解释
[y]=>0
是什么意思?这里[y]将从输入中重复此日期的次数。不确定如何执行。谢谢,让我检查一下执行情况
Array
(
    [0] => Array
        (
            [label] => July 18 2020
            [y] => 1
        )

    [1] => Array
        (
            [label] => July 20 2020
            [y] => 2
        )

)