<?php $arr = [0.12345,0.012345,0.0001239,0.0001209]; Foreach($arr as $val){ Preg_match("/([0\.]+)([0-9]+)/", $val, $match); Echo $match[1]. Substr(round("0.".$match[2],3),2,3)."\n"; }
You have javascript disabled. You will not be able to edit any code.