Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
PHP
php get only numbers from string
Joel Brown
Programming language:
PHP
2021-05-18 07:45:09
0
Q:
php get only numbers from string
jon hallman
Code:
PHP
2021-07-02 08:15:24
$str = 'In My Cart : 11 items'; $int = (int) filter_var($str, FILTER_SANITIZE_NUMBER_INT);
1
Tags
number
string
get
php
php get
Related
find in php string or
php remove characters not numbers or letters
php find if substring is in string
print only some characters of a string in php
php keep only numbers in string
php find multiple strings in string
only display part of string php
php get first digit of number
php get part of string
check value contains numbers or letters php
get only the first two word from a string php
find type in php
php get first character of string
php remove numbers from string
php validate only numbers
get words after string in in php
get number of chars ina string php
php get first 5 characters of string
php check if string or number
New to Communities?
Join the community