PHP output Two numbers in the middle of how many palindrome number method
This article mainly introduces the PHP output two numbers in the middle of how many palindrome number of methods, the case analysis of the concept of palindrome number and related judgment skills, the need for friends can refer to the next
This example describes how many palindrome numbers are in the middle of a PHP output of two digits. Share to everyone for your reference. The specific analysis is as follows:
"Palindrome number" is a number. such as: 98789, this number is reading is 98789, the reading is 98789, is reading the same, so this number is palindrome number.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
for ($i =10; $i <100; $i + +) { $len =strlen ($i); $l = 1; $k =intval ($len)/2+1; for ($j =0; $j < $k; $j + +) { if (substr ($i, $j, 1)!=substr ($i, $len-$j -1,1)) $l = 0; Break } if ($l ==1) echo $i. ' '; } ?> |
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/973129.html www.bkjia.com true http://www.bkjia.com/PHPjc/973129.html techarticle PHP output Two numbers in the middle of how many palindrome number of methods this article mainly introduces the PHP output two numbers in the middle of how many palindrome number of methods, the case analysis of the concept of palindrome number and phase ...