ip2long() gibt negativen Int zurück

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ip2long() gibt negativen Int zurück

    Hi,

    ich habe folgenden Code:
    PHP Code:
    <?php
            
    echo ip2long('192.168.0.1');
    ?>
    Als Rückgabewert bekomme ich -1062731775. Da stimmt doch irgendwas nicht!

    PHP 4.3.3 (cli) (built: Oct 14 2003 01:10:44)
    mfg,
    muckel

  • #2
    ip2long('123.123.45.45') nimmt der wunderbar!

    Ich könnte jetzt vermuten, dass der mit den positiven werten nicht auskommt.
    Last edited by TobiaZ; 21-10-2003, 16:26.

    Comment


    • #3
      tada! (gut da ich nur blind vermutet habe)

      wer das manual liest, ist klar im Vortail:

      Note: Because PHP's integer type is signed, and many IP addresses will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned IP address.

      Comment


      • #4
        Ja das da kommt bei mir auch ein Postiver Int-Wert zurück, aber bei 192.168.0.1 und meiner Internet-IP nicht.
        mfg,
        muckel

        Comment


        • #5
          siehe mein nächstes Post, bzw. Manual!

          Comment


          • #6
            Original geschrieben von TobiaZ
            tada! (gut da ich nur blind vermutet habe)

            wer das manual liest, ist klar im Vortail:
            Oha, aber davon steht auf php.net irgendwie nix!

            Zumindest nicht im Deutschen Manual =)
            mfg,
            muckel

            Comment


            • #7
              wir können doch english! Die Deutsche Version war immer schon unvollständig!

              Comment


              • #8
                hehe, na klar... erstmal Browser auf [en] umstellen, damit das nicht noch einmal vorkommt =)
                mfg,
                muckel

                Comment


                • #9
                  reicht, wenn du bei problemen mal eben ein en in die URL einfügst. wenn alles läuft, kannst du ja ruhig de nehmen.

                  Comment

                  Working...
                  X