Why do these nested while loops not work?

Posted by aliov on Stack Overflow See other posts from Stack Overflow or by aliov
Published on 2010-06-06T00:34:42Z Indexed on 2010/06/06 0:42 UTC
Read the original article Hit count: 502

Filed under:
|
|

I tried and tried and tried to get this code to work and kept coming up with zilch. So I decided to try it using "for loops" instead and it worked first try. Could somebody tell me why this code is no good?

<?php
$x = $y = 10;

while ($x < 100) {
    while ($y < 100) {
        $num = $x * $y;
        $numstr = strval($num);
        if ($numstr == strrev($numstr)) {
            $pals[] = $numstr;
        }
        $y++;
    }
    $x++;   
}
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about nested