从整数中删除分隔符

How can I remove the comma separator from a number

e.g. 40,000 resulting in 40000 in php?

function cleanData($a) {
     $a = (int)str_replace( '.', '', $a );
     return $a;
}

I've tried using this function only when I compare the result (===) of cleanData($a) with 40000 it doesn't match types?

Try this:

function cleanData($a) {
     $a = (int) str_replace( ',', '', $a );
     return $a;
}

First of all, you want to replace commas (,), not periods. Second, === checks types as well as value so you must typecast from a string to an integer using (int). You did that part, but you weren't replacing commas so the value was 40, not 40000.

Example:

<?php
var_dump((int) str_replace( '.', '', '40,000')); // int(40)
var_dump((int) str_replace( ',', '', '40,000')); // int(40000)