title: Pass javascript array to php by using curly braces key name
body: <p>My js code:</p>
  
  <pre><code>$(function(){
      var arr = new Array('jj', 'kk', 'oo');
      $.post('test12.php', {'arr[]': arr}, function(data){
          alert(data);
      });
  });
  </code></pre>
  
  <p>PHP code:</p>
  
  <pre><code>&lt;?php
  echo print_r($_POST['arr']);
  </code></pre>
  
  <p>The thing is,$.post receive a key named 'arr[]',it should be used in PHP as 'arr[]' instead of 'arr',but '$_POST['arr[]']' doesn't work,'arr' works.Which seems that Jquery might do something with curly braces '[]' before sending something to PHP.</p>
  
  <p>Secondly,when I remove the single quotas around 'arr[]',PHP can not receive anything by using $_POST['arr'];,<strong>I don't know why?</strong></p>
  
  <p>Doing this task in a traditional way with no curly braces:</p>
  
  <pre><code>$.post('test12.php', {arr: arr}, function(data){
          alert(data);
      });
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>So when sending javascript array to PHP,<strong>why bothering using single quote and curly braces like</strong></p>
  
  <pre><code>'arr[]'
  </code></pre>
  
  <p>instead of using a concise way like arr:arr</p>
  
  <p>My return result is </p>
  
  <pre><code>Array(
     [0]=&gt;jj
     [1]=&gt;kk
     [2]=&gt;oo
  )
  1
  </code></pre>
  
  <p><strong>Notice there is a 1 under the array,why?</strong></p>