Results 1 to 7 of 7

Thread: numerical notation oddity

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default numerical notation oddity

    PHP Code:
    <?php
    $b
    ="&#0";
    $a=8238;
    while (
    $a<8240)
    {
    $b.="$a;";
    echo
    "XX $a XX $b <br>";$b="&#";
    $a++;}
    ?>
    I would expect the output to be:

    XX 8238 XX character
    XX 8239 XX character
    instead I get:
    XX 8238 XX *
    XX 8239 XX
    It's best if you run the script yourself to see what I am talking about. The value for $a is strange for a while after that; a few hundred I think.

    Any ideas what is going on here?
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There are a few reasons this is complicated:
    1. The first iteration you have (for some reason I don't understand) started it with a 0.

    The output that I see is:
    HTML Code:
    XX 8238 XX * <br>XX 8239 XX   <br>
    Or, what the browser displays:
    XX 8238 XX
    XX 8239 XX
    Thus you are creating 08238 then 8239, not sure why.

    What are these characters, and in what character encoding? You should specify unicode (I expect that's the only one that goes up that high) in your html tag, so that the page displays correctly.

    HOWEVER, that generates some sort of very weird RTL character (maybe a space??) that actually completely messes up my text here if I paste it (the browser 'output' above was retyped).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Try this:
    PHP Code:
    <?php
    $b
    ="";
    $a=8238;
    while (
    $a<8240$b="";)
    {
    $b.="$a;";
    echo
    "XX $a XX $b <br>";$b="&#";
    $a++;}
    ?>
    I don't know exactly what you are trying to do, but fiddle with the $b term in the while loop and it might work out.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I am not sure what these unicode characters are. Just trying to explore unicode to view all of the different dashes and hyphens that there are till I find one in a style that I like. I may have to fiddle with the font-family as well.

    I fixed up the code to remove the leading 0 so it now looks like:

    PHP Code:
    <?php
    $a
    =8238;
    while (
    $a<8240)
    {
    $b='&#';
    $b.="$a;";
    echo 
    "XX $a XX $b <br>";
    $a++;}
    ?>
    fileserverdirect, your code had a few errors in it, so I cleaned it up.
    To choose the lesser of two evils is still to choose evil. My personal site

  5. #5
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Sorry, I was thinking foreach syntax whereas you can do that. So it works?
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There's an entire list of Unicode here:
    http://www.alanwood.net/unicode/
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    fileserverdirect, not yet, but that's alright. I still get the same errors.

    djr33, As simple as my script is I think I like the site you mentioned better and will be looking through that one.

    thanks for the help guys
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •