PHP ob_get_clean removing newlines after ?>
<p>I am trying to create a function that grabs a script file and executes the output on a telnet device. I have it working, but ob_get_clean seems to be removing any newlines after a php closing brace (?>). Has anyone encountered this problem? </p>

<pre><code>public final function execScript($name, $args)
{
    ob_start();
    include("../apps/frontend/modules/device/scripts/" . $name . ".php");
    $partial = ob_get_clean();
    $commands = explode("\n", $partial);

    foreach($commands as $command)
    {
        $output .= $this-&gt;telnet-&gt;exec($command);
    }

    return $output;
}
</code></pre>

<p>"Script"</p>

<pre><code>conf
int ethernet 1/&lt;?php echo $args['port']; ?&gt;
switchport allowed vlan add &lt;?php echo $args['vlan_id']; ?&gt; tagged
switchport native vlan &lt;?php echo $args['vlan_id']; ?&gt;
switchport allowed vlan remove 1
end
</code></pre>

<p>Expected Output</p>

<pre><code>conf
int ethernet 1/18
switchport allowed vlan add 100 tagged
switchport native vlan 100
switchport allowed vlan remove 1
end
</code></pre>

<p>Actual Output</p>

<pre><code>conf
int ethernet 1/18switchport allowed vlan add 100 tagged
switchport native vlan 100switchport allowed vlan remove 1
end
</code></pre>
