Avatar

functions.inc.php (Bugs)

by Auge ⌂, Monday, November 01, 2010, 11:45 (4922 days ago) @ Micha

Hello

except you give an empty encoding declaration to my_substr.

$substring = my_substr($string, '');


Isn't it possible to check the $encoding variable inside the function like?

function my_strlen($string, $encoding='utf-8') {
if(function_exists('mb_strlen')) 
return mb_strlen($string, empty($encoding)?"utf-8":$encoding);
else
return strlen($string);
}

Arrgh! a complete if-else-switch inside a function call. That is to much "JavaScript stylish" for me. ;-)

Yes it is possible to check $encoding for emptyness. But why? If you don't set a different encoding in the many many function calls there is a value for $encoding inside my_strlen.

So there is only one question: Why gets D-Grund Nyheder the error message(s)?

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread