title: Most efficient way to replace empty values in an array
body: <p>Is there a better way of doing this PHP code? What I'm doing is looping through the array and replacing the "title" field if it's blank.</p>
  
  <pre><code>if($result)
  {
      $count = 0; 
  
      foreach($result as $result_row)
      {
          if( !$result_row["title"] )
          {
              $result[$count]["title"] = "untitled";
          }
  
          $count++;
      }
  }
  </code></pre>
  
  <p>Where <em>$result</em> is an array with data like this:</p>
  
  <pre><code>Array
  (
          [0] =&gt; Array
                  (
                          [title] =&gt; sdsdsdsd
                          [body] =&gt; ssdsd
                  )
  
          [1] =&gt; Array
                  (
                          [title] =&gt; sdssdsfds
                          [body] =&gt; sdsdsd
                  )
  
  
  )
  </code></pre>
  
  <p>I'm not an experienced PHP developer, but I guess that the way I've proposed above isn't the most efficient?</p>
  
  <p>Thanks</p>