title: Using square brackets and assigning variables in PHP
body: <p>I have seen source code like:</p>
  
  <pre><code>$something = $sql['value']
  </code></pre>
  
  <p>I have searched a lot about it and I found that it's from arrays. But I didn’t understand the exact meaning.</p>
  
  <p>For example,</p>
  
  <pre><code>$people = [
  
   'Susan' =&gt; [
      'Age' =&gt; 24,
  'Phone' =&gt; '555-123-4567'
  ],
  
    'Jack' =&gt; [
  
    'Age' =&gt; 27,
  
    'Phone' =&gt; '555-9876-5432'
  
    ]
  ];
  
  echo $people['Jack']['Age']; // 27
  </code></pre>
  
  <p>Can we write code like the following?</p>
  
  <pre><code>if(!empty($people)
  
      $something = $people['a value']
  </code></pre>
  
  <p>I just need to know how we can declare a variable and give a value in square brackets.</p>