- substr: documentation ( source)
- strtoupper: documentation ( source)
- pow: documentation ( source)
<?php
$arr = ["K" => 1 ,"M" => 2, "T" => 3];
$input = "12.2K";
if(isset($arr[strtoupper(substr($input, -1))])){
echo substr($input,0,-1) * pow(1000, $arr[strtoupper(substr($input, -1))]);
}else{
echo $input;
}