title: Truncate up to 8 characters, change to small words, remove special characters
body: <p>email: <code>emDSDla.ccount@gmail.com</code></p>
  <pre><code>&lt;?php
  $useruser = $customer-&gt;email; 
  ?&gt;
  
  &lt;?php echo $useruser ?&gt;
  </code></pre>
  <p>I need to create from customer email, I need to create username.</p>
  <p>With rule:</p>
  <ul>
  <li>get only first 8 characters</li>
  <li>remove special characters @ .</li>
  <li>change to small words</li>
  </ul>
  <p><strong>result:</strong></p>
  <pre><code>emdsdlac
  </code></pre>
  <p>Can anyone help me implement this to code?</p>
  <p><strong>update:</strong></p>
  <pre><code>&lt;?php   $useruserBIG = 'emDSDla.ccount@gmail.com'  ?&gt;
      
  &lt;?php $resultsmall = strtolower($useruserBIG); ?&gt;
  
  &lt;?php echo $resultsmall ?&gt;
  
  &lt;?php 
  $newstr = preg_replace('/[^a-zA-Z0-9\']/', '_', $resultsmall);
  $newstr = str_replace(&quot;@&quot;, '', $resultsmall);
  
  ?&gt;
  
  &lt;?php echo $newstr ?&gt;
  </code></pre>
  <p>Currently I get result:</p>
  <pre><code>emdsdla.ccountgmail.com
  </code></pre>
  <p>Can anybody help me improve this code (merge in one  and correct with truncate) to get
  <strong>result:</strong></p>
  <pre><code>emdsdlac
  </code></pre>
  <p>Thanks!</p>
  <p><strong>update3:</strong>
  currently I get correct result with this:</p>
  <pre><code> &lt;?php   $useruserBIG = 'emDSDla.ccount@gmail.com'  ?&gt;
      
  &lt;?php $resultsmall = strtolower($useruserBIG); ?&gt;
  
  
  &lt;?php 
  $newstr = preg_replace('/[^a-zA-Z0-9\']/', '', $resultsmall);
  
  ?&gt;
  
  &lt;?php echo substr($newstr, 0, 8) ?&gt;
  </code></pre>
  <p><strong>result from above code:</strong></p>
  <pre><code>emdsdlac
  </code></pre>
  <p>The problem is, I cannot display in my script result some like this:</p>
  <pre><code>&lt;?php echo substr($newstr, 0, 8) ?&gt;
  </code></pre>
  <p>I can display result only with variable some like:</p>
  <pre><code>&lt;?php $resultaftertruncate ?&gt;
  </code></pre>
  <p>can anyone else help me to customize this code?</p>