PHP: less ugly syntax for named parameters / arrays?

前端 未结 4 1379
暖寄归人
暖寄归人 2021-01-14 13:48

Here\'s what I am trying to accomplish:

function foo($args) {
 switch($args[\'type\']) {
  case \'bar\':
  bar($args[\'data\']);   // do something
  break;
          


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-14 14:38

    No. Alternative syntaxes for creating arrays have been proposed several times (the link lists 5 separate threads in the dev mailing list), but they were rejected.

提交回复
热议问题