limit a string length by characters
<p>Hi I have this piece of code and wanted to <code>echo "&lt;/dd&gt;\n", chr(20);</code> with only 20 characters or whatever i choose.
Where am i going wrong?</p>

<p>Thanks</p>

<pre><code>class newsStory{
    var $title="";
    var $link="";
    var $description="";
    var $pubdate="";

    function show(){
        if($this-&gt;title){
            if($this-&gt;link){
                echo "&lt;dt&gt;&lt;a href=\"$this-&gt;link\"&gt;$this-&gt;title&lt;/a&gt;&lt;/dt&gt;\n";
            }elseif($this-&gt;title){
                echo "&lt;dt&gt;$this-&gt;title&lt;/a&gt;&lt;/dt&gt;\n";
            }
            echo "&lt;dd&gt;";
            if($this-&gt;pubdate)
                echo "&lt;i&gt;$this-&gt;pubdate&lt;/i&gt; - ";
            if($this-&gt;description)
                echo "$this-&gt;description";
            echo "&lt;/dd&gt;\n", chr(20);
        }
    }
}
</code></pre>
