Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5

Thread: PHP ereg();

  1. #1
    Join Date
    Apr 2006
    Location
    England
    Posts
    1,159
    Tokens
    0

    Latest Awards:

    Default PHP ereg();

    Hey,

    I want to use the ereg function to find MSIE followed by any number between 0 and 7.0. For instance MSIE 5.01. What would be the valid regular expression for this?

    Thanks in advance,
    Olii
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    $input 
    "MSIE 5.01";
    $eimput explode(" "$input)
    $num $eimput[1];

    ereg ("([0-7]{1}).([0-99]{2,1})"$num$finout);

    echo 
    "Returned: ";
    echo 
    $finout[1];
    echo 
    ".";
    echo 
    $finout[2];

    ?>
    Not tested, may not work.
    Last edited by Tomm; 21-10-2006 at 08:00 PM.

  3. #3
    Join Date
    Nov 2004
    Location
    HabboWeb FM Offices
    Posts
    3,019
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Organised View Post
    PHP Code:
    <?php
    $input 
    "MSIE 5.01";
    $eimput explode(" "$input)
    $num $eimput[1];

    ereg ("([0-7]{1}).([0-99]{2,1})"$num$finout);

    echo 
    "Returned: ";
    echo 
    $finout[1];
    echo 
    ".";
    echo 
    $finout[2];

    ?>
    Not tested, may not work.
    Nope
    Parse error: syntax error, unexpected T_VARIABLE in /home/shake/public_html/Tom/index.php on line 4

  4. #4
    Join Date
    Sep 2006
    Posts
    234
    Tokens
    0

    Default

    I got it too.
    Piano Back on MONDAY!


  5. #5
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Try:

    PHP Code:
    <?php 
    $input 
    "MSIE 5.01"
    $eimput explode(" "$input
    $num $eimput[1]; 

    if(
    ereg ("([0-7]{1}).([0-99]{2,1})"$num$finout)){ 

    echo 
    "Returned: "
    echo 
    $finout[1]; 
    echo 
    "."
    echo 
    $finout[2]; 
    }
    ?>
    Last edited by Tomm; 22-10-2006 at 07:30 AM.

Posting Permissions

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