dotcraq3249 2014-05-07 20:29
浏览 10
已采纳

存储3级信息需要多维数组?

I'm working on a PHP script to hold a lot of information. Lets try to explain our situation!

I have actually 33 different stations. For each of that 33 stations I have 5 different categories. And for each of that 33 stations with each 5 different categories i have 37 different values per category.

Do I need an 2d of 3d array for store this information in it ?

Thanks you!

  • 写回答

5条回答 默认 最新

  • duanletao9487 2014-05-07 20:38
    关注

    Something like this will work, just add more data as needed:

    $station_array =  
        array(
            'station1' => array(
                'cat1' => array ('val1','val2','val3'),
                'cat2' => array ('val1','val2','val3'),
                'cat3' => array ('val1','val2','val3')
            ),
            'station2' => array (
                'cat1' => array ('val1','val2','val3'),
                'cat2' => array ('val1','val2','val3'),
                'cat3' => array ('val1','val2','val3')
            ),
            'station3' => array (
                'cat1' => array ('val1','val2','val3'),
                'cat2' => array ('val1','val2','val3'),
                'cat3' => array ('val1','val2','val3')
            )
        );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀