Jump to content

adrianpat

New Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About adrianpat

  • Rank
    Newbie
  1. Hi, I am a beginner in Php and I need your help for the following problem: I need to write a code to obtain the strobogrammatical numbers until 10000. I start with the following code but I need your help for the final part: <html> <head> <title>test upsideup </title> </head> <body> <?php function reverse_digit($digit){ switch($digit){ case 0: return 0; case 1: return 1; case 6: return 9; case 8: return 8; case 9: return 6; default: return -1; } } function testUSU($number){ $num2 = $number; // current power of 10 $i = 0; $reverse = 0; while ($num2 > 0){ $i = $i + 1; $num2 = $num2 / 10; } $reverse = $number % 10; $reverse = $number % 10; } for ($x = 0; $x < 10; $x++) { $num = reverse_digit($x); if ($num != -1){ echo "digit = $x <br>"; echo "reverse = $num <br>\n"; } } //$test = 10.7; //echo intval($test); ?> </body> </html> Thanks, Adrian
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.