Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
Created December 16, 2014 06:15
Show Gist options
  • Save frozonfreak/9171fdb2c41eb952bc4f to your computer and use it in GitHub Desktop.
Save frozonfreak/9171fdb2c41eb952bc4f to your computer and use it in GitHub Desktop.
PHP String length calculation
public function getActualLength($string){
$charArray = str_split($string);
$output = array();
foreach ($charArray as $char){
if (isset($char) && !empty($char) && $char != '' && ord($char) != 14) $output[] = $char;
}
return count($output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment