我正在编写一个应用程序,允许用户修改和更改他们的一些网站设置.我只是构建一个表单生成器,它将向variuous插件发送各种选项以生成代码,我想知道我是否应该使用对象而不是多维数组?如果是这样,我将如何更改我的代码?
所以现在我已经做了这个 - 它很长并且会变得更长,所以为了简洁起见我只粘贴了一部分: -
$scopeSettings = array(
    'site_background' => array(
        'subpanels' => array(
            'colour' => array(
                'plugins' => array(
                    'colourchooser' => array(
                        'tip' => "The background colour appears underneath the 'Background Image' (if set)-hover over the '?' around the colour chooser for extra tips on how to use it",
                        'element' => 'body',
                        'gradientenabled' => 'true',
                        'opts' => array (
                            'closed' => 'true',
                            'advanced' => array(
                                'tip' => "You can paste in your own generated gradient codes in here",
                                'checkbox' => true
                            )//end advanced
                        )//end Opts
                    )//end colour chooser
                )//end plugins
            ),//end colour sub panel
            'pattern' => array(
                'plugins' => array(
                    'patternselector' => array(
                        'tip' => "Use the pattern selector to apply effects like moire or scan lines to your background image",
                        'element' => 'patimg'
                    )//end patternselector
                )//end plugins
            ),//end pattern sub panel
        )//end subpanels
    )//end site background
);//end scope settings
这种事情最好的做法是什么?
我想说,有些人喜欢面向数组的编程,并且使用 PHP 5.4,他们可以以一种很好的方式表达自己。然而,越来越多的人习惯了 OOP - 我也是如此 - 并且它可以是一种更具可读性的解决方案编码方式。