title: XDebug to evaluate when a Variable is set to True from 'else If' Statement
body: <p>I'm using PhpStorm in conjunction with a WAMP localhost and have xdebug enabled.</p>
  
  <p>Looking for the best solution to utilize xdebug and PhpStorm in order to debug my PHP script to see which line <code>$var = true;</code> </p>
  
  <p>Here's how my script looks. It's a nested <code>foreach</code> <code>for loop</code></p>
  
  <pre><code>foreach ($array as $index =&gt; $values) {
  
    $count = count($values);
  
          for ($i=0;$i&lt;$count;$i++) {
  
          $word = false;
          $string = $values[$i]['word'];
  
                 if (isset($values[$i+1]['word'])) { 
          $stringafter = $values[$i+1]['text'];
                                                    }
  
                if (strpos($string, 'Which') !== false &amp;&amp; $word != true) {
  
                     if (strpos($stringafter, 'of') !== false) {
  
                         $string = $string;
                         $word = true;
                                                                }
  
                      else {
  
                         $string = NULL;
                         $word = true;
  
                            }
  
                                                                          }
                                           //ending first if condition loop
  
                 elseif (preg_match('/[A-Z]/', $string) &amp;&amp; $word != true) {
                 //word contains at least one uppercase letter
  
                     $uc = preg_match('/^[A-Z]:\.*/', $string, $uccheck);
                     $firstletter = $uccheck[0];
  
                     if ($firstletter  == strtoupper($firstlette))  {
                         // first letter is uppercase        
                         $string = $string;
                         $word = true;
  
                                                                     }
  
                      else {
                          $string = NULL;
                          $word = true;
                           }
  
                                                                      }
                                   //ending first elseif condition loop
  
                  elseif ($word != true) {
  
                           $string = NULL;
                           $word = true;
  
                                         }
     //ending second elseif condition loop
  
  
  $word = false;
  // setting $word back to false at end of for loop for next word
  
  }
  //ending for loop
  
  }
  //ending foreach loop
  </code></pre>
  
  <p>Currently I'm just putting this breakpoint right above <code>$searchword = false;</code></p>
  
  <pre><code>        if ('test' == 'test') {
              $true = true;
              $getword = $word;
          }
  </code></pre>
  
  <p>And then I'm able to iterate through each loop and condition and it will tell me one by one if it goes through this loop and where <code>$word = true</code>; is occurring.</p>
  
  <p>This is helpful but seems needlessly slow if all I'm looking to do is find out where in the conditional loops <code>$word = true;</code> is occurring for each of my <code>$string</code> variables in the <code>for loop</code>.</p>
  
  <p>I was hoping I could just right click on the debugger > variables console in PhpStorm where it says <code>$word = true;</code> and choosing the option <code>'Jump to Source'</code>.. but instead it just brings me back to the beginning of my for loop where <code>$word = false</code> is declared.</p>
  
  <p>Is there an easier way besides iterating or reviewing the output to automatically tell me where <code>$word = true;</code> is being defined on, instead of manually looking at the debug output?</p>
  
  <p>Edit:</p>
  
  <p>Comments were getting a bit long so I thought I'd reiterate.</p>
  
  <p>@MrGlass helped by explaining that condition statements such as <code>($word == true)</code> can be utilized in <code>if</code> statements, but upon further testing this condition only works on <code>if</code> statements and not <code>elseif</code> statements.</p>
  
  <p>Example:</p>
  
  <pre><code>Line 100:   elseif (preg_match('/[A-Z]/', $string) &amp;&amp; $word != true) {
  Line 101:      //word contains at least one uppercase letter
  Line 102:          $uc = preg_match('/^[A-Z]:\.*/', $string, $uccheck);
  Line 103:          $firstletter = $uccheck[0];
  Line 104:   if ($firstletter  == strtoupper($firstlette))  {
  Line 105:      // first letter is uppercase        
  Line 106:          $string = $string;
  Line 107:          $word = true;
  Line 108:    }
  Line 109:    }
  </code></pre>
  
  <p>As quaintly explained in my comments below if I attach a condition in PHPStorm such as <code>$word == true</code> or <code>($word == true)</code> to <code>Line 100</code>, I get no results/breakpoints. If I attach it to the ending curly braces on <code>Line 108</code> or <code>Line 109</code>, I still get no matches to my breakpoints.</p>
  
  <p>If I put my breakpoint on Line 104 with the condition <code>($word == true)</code> I get the results I Want.</p>
  
  <p>Is there anyway to get xDebug to track this condition in <code>elseif</code> statements?</p>