PHP output Two numbers in the middle of the number of Palindrome method _php Tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.