title: PHP error variable error: Notice: Use of undefined constant FirstName - assumed 'FirstName'
body: <pre><code>foreach ($array as $row){
      $forEachCount++; //increment counter
  
      // naming logic
      if (empty($row['DisplayName'])) { // if there is no DisplayName
          if (empty($row['FirstName'])) { // show lastname
              $block[] = "&lt;div class='block'&gt;".$row['LastName']."&lt;/div&gt;\n";
          }
  
          else { //show first + last if no display name
              $block[] = "&lt;div class='block'&gt;".$row['FirstName']." ".$row['LastName']."&lt;/div&gt;\n";
          }
  
      } else { // show display name
          $block[] = "&lt;div class='block'&gt;".$row['DisplayName']."&lt;/div&gt;\n";
      }
  }
  </code></pre>
  
  <p>What looks wrong in this code? The sort works fine when there's only a last name, or a display name. It only doesn't work when there's no display name so it concatenates the First + Last.</p>