I want to make a sub-string, where the $count only counts letters, not spaces. This is what I have so far:
$count
$string =\"vikas tyagi php\"; $strin
$arr = explode(" ",$str); $length = 10; for ($i = 0, $currIndex = 0, $finalstring = ""; $currIndex < $length; $i++){ $finalstring .= " ".substr($arr[$i], 0, $length - $currIndex); $currIndex += strlen($arr[$i]); }
Here is a demonstration: http://codepad.org/lv4KEsAi