如何创建PHP数组的汇总值?



如何做php数组的汇总值?

我想这样显示结果。


Array
(
    [0] => Array
        (
            [0] => DEVICE_1
            [1] => LOW
            [2] => STAGE_1
        )
    [1] => Array
        (
            [0] => DEVICE_2
            [1] => LOW
            [2] => STAGE_1
        )
    [2] => Array
        (
            [0] => DEVICE_2
            [1] => LOW
            [2] => STAGE_2
        )
    [3] => Array
        (
            [0] => DEVICE_3
            [1] => MEDIUM
            [2] => STAGE_1
        )
    [4] => Array
        (
            [0] => DEVICE_3
            [1] => HIGHT
            [2] => STAGE_2
        )
    [5] => Array
        (
            [0] => DEVICE_3
            [1] => HIGHT
            [2] => STAGE_3
        )
)

您在哪里获得映射,如LOW = 1?替换为您的映射内循环

foreach ( $array as $device ) {
    $deviceInfo = '';
    foreach ( $device as $specs ) {
         $deviceInfo .= $specs . ' ';
    }
    echo $deviceInfo;
}

相关内容

  • 没有找到相关文章

最新更新