Setting a variable for a view template
First, there is a simple way to flatten out those loops, but it is not what I would suggest.  Here is the simple way:

if ((sizeof($var) == sizeof($content))) {
    $count = sizeof($var);

    for ($i =0; $i &lt; $count; $i++) {
        $this-&gt;template = str_replace(
            '{' . $var[$i] . '}', $content[$i], $this-&gt;template);
    }
}


Note that you are currently silently doing nothing when the size of your arrays don't match.  I think that is a bug.

My Suggestions

$var and $content are not very descriptive: I would suggest $match and $replacement.

str_replace can handle arrays as input.  I would suggest filling your match with the '{' and '}' beforehand.  The code then becomes:

public function set($match, $replacement)
{
   $this-&gt;template = str_replace($match, $replacement, $this-&gt;template);
}


I would place any sanity checks before the str_replace that you require.  str_replace uses blank replacements when the matches array is larger than the replacements.  If you want to avoid that use:

   if (is_array($match) &amp;&amp; is_array($replacement) &amp;&amp;
       sizeof($match) &gt; sizeof($replacement))
   {
      throw new InvalidArgumentException(
         __METHOD__ . ' Each match must have a replacement');
   }


This avoids arrow code which will make the code easier to test, reduce its complexity and make it easier to maintain.