title: Finding unused variables in CakePHP views
body: <p>Currently, I am using NetBeans IDE and it has a very nice feature which shows if a variable is defined but is not used in its scope. This works very nicely if you have bunch of old code, and you are trying to remove the dead bits from it.</p>
  
  <p>Is there a tool/service/anything, which would do the same thing however which would find variables which are set in the controller but then not used in a view. It does not have to be fully automatic.</p>
  
  <p>For example if you have the following in your controller:</p>
  
  <pre><code>$this-&gt;set(array(
       'variable1' =&gt; $variable1,
       'variable2' =&gt; $variable2
  )); 
  </code></pre>
  
  <p>And the view looks like this:</p>
  
  <pre><code>&lt;p&gt;Peter ate &lt;?php echo $variable1; ?&gt; apples.
  </code></pre>
  
  <p>It would highlight or in any other way identify <code>variable2</code> (given that it is not used in layout as well).</p>