PHP Variable vs Array vs Object

前端 未结 7 1365
忘掉有多难
忘掉有多难 2020-12-31 18:03

This is probably considered a really silly question, but I\'m in the process of putting together a simple template system for a website and am trying to keep track of my var

7条回答
  •  时光取名叫无心
    2020-12-31 18:43

    In the end they are the same, It depends on the preference, although I would use arrays or objects because you can group variables in there, so you have things better sorted out.

    Despite the objects method works I think it's not the natural intended use for it.

    So I would say arrays!

    Also, there are tons of php native functions you can use with arrays, like array_map() or array_filter() array sortings and etc etc...

提交回复
热议问题