<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $n = "wwww watt zzzzzzzzzzzzzz"; $n = preg_replace('/(.)\1+/', '$1$1', $n); echo $n; function truncate($str, $chars, $end = '') { if (strlen($str) <= $chars) return $str; $new = substr($str, 0, $chars + 1); return substr($new, 0, strrpos($new, ' ')) . $end; } $r = truncate('My rrr', 5); echo "<hr /> $r"; ?> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more