将haystack数组重写为新数组

时间:2015-07-31 14:08:49

标签: php arrays sum rewrite

我有一个很大的阵列,每个月有几个星期,每周我有用户,每个用户有3个不同的总数。退房:

<div class="modal fade centered" id="image-gallery" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog centered">
        <div class="modal-content siteImageButton">
            <div class="modal-body text-center">
                <img id="image-gallery-image" src="" />
            </div>
        </div>
    </div>
</div>

我想创建一个获取用户值并在一个数组中统一的数组,如下所示:

Array //REPRESENTS THE MONTH
(
    [0] => Array //REPRESENTS THE WEEK 1 
        (
            [week] => 1
            [user1] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
            [user2] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
            [user3] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
        )
    [2] => Array //REPRESENTS THE WEEK 2
        (
            [week] => 2
            [user1] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
            [user2] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
            [user3] => Array
                (
                    [0] => Array
                        (
                            [total1] => value
                            [total2] => value2
                            [total3] => value3
                        )
                )
        )
    ...

我是怎么做到的?

0 个答案:

没有答案