Skip to content

Instantly share code, notes, and snippets.

@rafasashi
Created April 14, 2015 11:51
Show Gist options
  • Save rafasashi/73fb3b15892253d80273 to your computer and use it in GitHub Desktop.
Save rafasashi/73fb3b15892253d80273 to your computer and use it in GitHub Desktop.
<?php
function custom_strlen($str=''){
$strlen=0;
if(is_string($str)){
if(function_exists('mb_strlen')){
$strlen= mb_strlen($str);
}
else{
$strlen= strlen($str);
}
}
else{
//vdump($str);
}
return $strlen;
}
function strlen_compare($a,$b){
return custom_strlen($b) - custom_strlen($a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment