"This is my string with some decimal number which is 58.2 m2"
what I need get from it is that number 58(without anything after decimal)
Only possible solution I was able to think about was something like:
$myString = "This is my string with some decimal number which is 58.2 m2";
$removedAllAfterDot= substr($myString , 0, strpos($myString , "."));
$myNewString = preg_replace('/[^0-9]/', '', $removedAllAfterDot);
Disadvantages of my solution:
It's so ugly!
It will not work in case there will be some other dots in string