title: How can I completly remove an object in php?
body: <p>I have the following code:</p>
  
  <pre><code>// delete an existing app using the app path
  public function deleteApp($app_path)
  {
      $content = file_get_contents('data.json');
      $content = json_decode($content);
  
      unset($content-&gt;apps-&gt;app_path);
      dd($content);
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <p><img src="https://i.stack.imgur.com/Jq1Fd.png" alt="enter image description here"></p>
  
  <p>Which means that unset did not remove the object.</p>
  
  <p>My problem, is how can I remove an entry from the <code>$content->apps</code> ?</p>
  
  <p>the code used for testing, as requested</p>
  
  <pre><code>// --------------------------------------------- testCanDeleteApp()
  public function testCanDeleteAnApp()
  {
      $local_data = new LocalData;
      $app_name = $this-&gt;getRandomName();
      $app_path = 'can/you/delete/me';
  
      // first let's add the app and make sure it exists
      $local_data-&gt;addNewApp($app_name, $app_path);
      $this-&gt;assertTrue($local_data-&gt;isAppExists($app_path));
  
      // then i just delete it.
      $local_data-&gt;deleteApp($app_path);
      $this-&gt;assertFalse($local_data-&gt;isAppExists($app_path));
  }
  </code></pre>