doucheng2053 2016-05-14 14:48
浏览 38

php 4-5维数组建议是否矫枉过正?

what i'm asking below issent a problem but a question regarding to what you! would do in my place.

i've started building my first dynamic php class, in the form off a table.

i've made it up like a factory class which takes 2 indputs on the construct:

$data = sql_query,
$columns = array(
                 array('type_checkbox' => 'name_of_id_to_look_for')
                 array('type_select' =>array(
                'select_class' => 'headline_name',
                'select_value1' => 'select_name1',
                'select_value2' => 'select_name2'))
                array('type_text' => 'headline_name')
);

the idea with this is changeing it on the fly with javascript diffrent states for viewing, editing, creating, so basicly CRUD

now is this overkill with a 4-5 layer deep array? how would you do it?

  • 写回答

1条回答 默认 最新

  • dongzi0850 2016-08-03 14:26
    关注

    This is too small information for me, personally I don't know what kind of info will be presented in such multilevel array.

    You must consider if it worth to make array of current item e.g. type_text.

    I tried to optimize this but don't know if it helps. based on data that you give I manage to optimize like this

    $columns = [
    'type_checkbox' => 'name_of_id_to_look_for',
    'type_text' => 'headline_name',
    'type_select' => [
        'select_class' => 'headline_name',
        'select_value1' => 'select_name1',
        'select_value2' => 'select_name2'
    ]
    

    ];

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法