$array = [
'user_id' => 'integer',
'currency' => 'float',
'price' => 'float',
];
$targetArray = $_POST;
foreach( $array as $name => $dataType ) {
if( isset( $targetArray[$name] ) ) {
settype( $targetArray[$name], $dataType );
}
}