title: Why PHP visibility like private property can still be modified and accessed?
body: <p>I am thinking why php added visibility such as private, protected, and public when you can still access it using arrow functions? Please see code below</p>
  <p><strong>Code</strong></p>
  <pre><code>&lt;?php
  
  class Foo
  {
    private $secret = 'foo';
  }
  
  $foo = new Foo();
  
  (fn() =&gt; $this-&gt;secret = 'bar')-&gt;call($foo);
  
  echo (fn() =&gt; $this-&gt;secret)-&gt;call($foo);
  </code></pre>
  <p><strong>Output</strong></p>
  <blockquote>
  <p>bar</p>
  </blockquote>
  <p><a href="https://onecompiler.com/php/3ycnkbn8z" rel="nofollow noreferrer">PHP Code Snippet</a></p>