Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to extract a number from given string using PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 254
    Comment on it

    Using the PHP will give you several benefit to use code what you want. And taking the number from any given string can be by diffrent - diffrent methods

    lets se the example below:-
    $myString = "I have 8 apples";
    preg_match("|\d+|", $s, $myString);
    var_dump($myString);
    

    This is done by using preg match and your output will be : Output:-

    8
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: