title: Split string with PHP Wordwrap in to two strings?
body: <p>Having a function that writes an XML, Problem is that values can't exceed 30 characters. In this scenario i need to split strings value and maintain readability. </p>
  
  <p>Wordwrap can solve this but i don't believe it's the right solution?</p>
  
  <p>First of all i need to determine if this is needed  </p>
  
  <pre><code>    $name = 'My name is very long'
  
      // over 30 characters?
      if (strlen($name) &lt; 30) {
  
          $this-&gt;xml-&gt;writeElement('Name', $name);
          $this-&gt;xml-&gt;writeElement('Name2', '');
  }
  </code></pre>
  
  <p>In the case that it exceed 30 characters i would like to do something like</p>
  
  <pre><code>   else {
  
        // Divide $name between Name &amp; Name2 maintaining readability, like
        $newname = wordwrap($name, 30,........ 
  
         // If i could end up with something like this 
         $this-&gt;xml-&gt;writeElement('Name', $newname1);
         $this-&gt;xml-&gt;writeElement('Name2', $newname2);
  }
  </code></pre>
  
  <p>Am unsure what approach and solution is the best, Have been digging around much and feels like none of the ways i found is optimal for my code.</p>