Do it the other way around:
$a = "1,435";
$b = str_replace( ',', '', $a );
if( is_numeric( $b ) ) {
$a = $b;
}
More Related Contents:
- Why does PHP consider 0 to be equal to a string?
- How do I replace certain parts of my string?
- PHP string replace match whole word
- how to replace special characters with the ones they’re based on in PHP?
- Replace last occurrence of a string in a string
- Search and replace multiple values with multiple/different values in PHP5?
- PHP prepend leading zero before single digit number, on-the-fly [duplicate]
- PHP function to replace a (i)th-position character
- Search and replace multiple values with multiple/different values in PHP?
- How do I check if a string contains a specific word?
- Split a comma-delimited string into an array?
- startsWith() and endsWith() functions in PHP
- PHP – concatenate or directly insert variables in string
- How to remove accents and turn letters into “plain” ASCII characters? [duplicate]
- Convert a comma-delimited string into array of integers?
- Get first 100 characters from string, respecting full words
- What is the best way to validate a credit card in PHP?
- Iterate over each line in a string in PHP
- Generate SEO friendly URLs (slugs) [closed]
- PHP: How can I explode a string by commas, but not wheres the commas are within quotes?
- Why does PHP convert a string with the letter E into a number?
- PHP: Split string into array, like explode with no delimiter
- How to open file in PHP that has unicode characters in its name?
- how to extract links and titles from a .html page?
- What’s the most efficient test of whether a PHP string ends with another string?
- Reverse the order of space-separated words in a string
- How to validate that a string only contain lowercase letters?
- Remove everything from the first occurrence of a character to the end of a string in PHP
- Regex to match an IP address [closed]
- How do I detect non-ASCII characters in a string?