3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $px = '1000px'; function get_cm_by_px($px, $dpi = 300, $precision = 2) { $comma = ','; // if US use '.' return number_format(2.54 * (int)$px / $dpi , $precision, $comma,'') ; } var_dump(get_cm_by_px($px));
based on 6fg2j
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(4) "8,47"