title: How to display a string with a character limit and charter limit is exclude space on that string in php
body: <p>I want to display a  string   as  specific number of count  but  count exclude  space on that string.For example   if  a string is "I want to go Edinburgh"  then it contain 4 spaces and it total length is 22 characters including spaces.I want to display this string as 15 character limit   so i use following  php code </p>
  
  <pre><code>$para ="I want to go Edinburgh";
  echo  substr($para,0,15);
  </code></pre>
  
  <p>its output is </p>
  
  <blockquote>
    <p>->I want to go Ed</p>
  </blockquote>
  
  <p>here 4 space is counted as 15 character limit</p>
  
  <p>Actually my expected  result is: </p>
  
  <blockquote>
    <p>I want to go Edinbu (4 space is not  counted)</p>
  </blockquote>
  
  <p>So i want to display above result in php </p>