数组之间的差异()和[]
我正在编写一个PHP应用程序,我想确保它能够正常工作。
原始代码:
<?php
$data = array('name' => 'test',
              'id'   => 'theID');
echo form_input($data);
?>
以下工作是否会出现错误,或者出于某种原因不推荐?
<?= form_input(['name' => 'test', 'id' => 'theID']); ?>
有什么区别吗?
  我已经在PHP.net中再次查看有关array()和方括号[]的短数组方法的数据,但我不确定。 
  而且,短php标签<?= ?>可以回显吗?  有没有版本问题?  (提供在php.ini中启用) 
  在PHP> = 5.4中支持[]后面的内容: 
['name' => 'test', 'id' => 'theID']
这只是一个简短的语法,在PHP <5.4中不起作用 。
链接地址: http://www.djcxy.com/p/10185.html上一篇: PHP Difference between array() and []
下一篇: how to get number of how much the string is common in a array
