Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
PHP
php keep only numbers in string
Jonan
Programming language:
PHP
2021-05-22 12:32:34
-1
Q:
php keep only numbers in string
Phil
Code:
PHP
2021-06-26 17:31:12
$str = preg_replace('/[^0-9.]+/', '', $str);
1
Tags
number
string
php
Related
php remove characters not numbers or letters
php count amount of times a value appears in array
php get only numbers from string
php find multiple strings in string
php validate only numbers
check value contains numbers or letters php
only display part of string php
replacing some digits of a number with asterisks php
php count words in a string
php count string in array
php get first 5 characters of string
add two numbers in php
php keep only digitts
get only the first two word from a string php
how to check if PHP variable contains non-numbers?
php open file capital letters or not
print only some characters of a string in php
php string only letters
php remove numbers from string
New to Communities?
Join the community