Created
November 13, 2013 13:20
-
-
Save lerua83/7448987 to your computer and use it in GitHub Desktop.
PHP - Extract numbers from a string: URL: http://stackoverflow.com/questions/6278296/extract-numbers-from-a-string
I want to extract the numbers from a string that contains numbers and letters like
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$str = 'In My Cart : 11 12 items'; | |
preg_match_all('!\d+!', $str, $matches); | |
print_r($matches); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment