I prefer the second option. It makes no sense to define an function that only executes another function. You don’t add anything to the language, and it only makes it confusing for other programmers if they ever have to work with your code.
function longness($text) {
return charnum($text);
}
function charnum($text) {
return stringsize($text);
}
function stringsize($text) {
return length($text);
}
function length($text) {
return strlen($string);
}
function howlong($text) {
for ($=0;$x<1000000;$x++); // act as though we're pondering things over
$x=rand(1,4);
switch ($x) {
case 1: return longness($text);
case 2: return charnum($text);
case 3: return stringsize($text);
case 4: return length($text);
default: return strlen($text);
}
}