title: In general, ++ is the same thing as +1. Why ++ != +1 on this code?
body: <p>I used foreach, &amp;, ++, +1.</p>
  <p>In general, ++ is the same thing as +1.
  but ++ != +1 on this code<code>(php7.3.4)</code>, why?</p>
  <pre class="lang-php prettyprint-override"><code>$data1 = $data2 = [
      ['id' =&gt; 0],
      ['id' =&gt; 1],
      ['id' =&gt; 2],
  ];
  foreach ($data1 as $key =&gt; &amp;$val) {
      $val['id'] = $val['id']++;
  }
  foreach ($data2 as $key =&gt; &amp;$val) {
      $val['id'] = $val['id']+1;
  }
  
  var_dump($data1 == $data2); // false. why?
  </code></pre>
  <p>thank <a href="https://stackoverflow.com/users/1213708/nigel-ren">Nigel Ren</a></p>
  <p>I change this code</p>
  <pre class="lang-php prettyprint-override"><code>foreach ($data1 as $key =&gt; &amp;$val) {
      // $val['id'] = $val['id']++;
      $val['id']++;
  }
  </code></pre>
  <p>the result is <code>true</code>.
  but i don't know why <code>$val['id'] = $val['id']++</code> != <code>$val['id']++</code>?</p>