Programming Tutorials

(追記) (追記ここまで)

Function to return number of digits of an integer in PHP

By: Iletras in PHP Tutorials on 2011年04月08日 [フレーム]

This is a very simple but useful function to return number of digits of an integer.

//function declaration
function count_digit($number) {
return strlen((string) $number);
}
//function call
$num = 12312;
$number_of_digits = count_digit($num); //this is call :)
echo $number_of_digits;
//prints 5



(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /