-1

I'm trying to remove a whitespace from a string, but this whitespace its not detected, i've tried so many solutions like str_replace(), preg_replace() htmlentities() an html_entity_decode() but its not working because i can't detect this whitespace even if it's really present.

So any ideas please ?

An example : 7412 148 ==> The goal is : 7412148 PS : i've tried to convert it to INT (not working) !

Thanks

karim karim
  • 81
  • 1
  • 1
  • 11

1 Answers1

1

Let's use preg_replace to replace/remove everything that is not a digit.

$str = "1234 5657"; // this is an example

$number = preg_replace("/[^0-9]/","",$str);

print $number;

Use this with the string that your function returns and let us know if it works.

Alex Andrei
  • 7,315
  • 3
  • 28
  • 42