Skip to content

Instantly share code, notes, and snippets.

@buiquangduc
Last active October 8, 2017 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buiquangduc/ef4fb64de9bf3f52ee6358fc306f4d36 to your computer and use it in GitHub Desktop.
Save buiquangduc/ef4fb64de9bf3f52ee6358fc306f4d36 to your computer and use it in GitHub Desktop.
Simple routine advances
<?php
// Example of simple code
$points = $deviceUnits * ( POINTS_PER_INCH / DeviceUnitsPerInch() );
// You can create a simple routine like that
function DeviceUnitsToPoints($deviceUnits) {
return $deviceUnits * ( POINTS_PER_INCH / DeviceUnitsPerInch() );
}
// And then replace the simple code above with
$points = DeviceUnitsToPoints($deviceUnits);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment