3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $lat = 60; $lon = 160; $zoom = 3; $nLon = ($lon / 360) + 0.5; $nLat = abs((asinh(tan(deg2rad($lat))) / M_PI / 2) - 0.5); $scale = 1 << $zoom; $tileX = (int)($nLon * $scale); $tileY = (int)($nLat * $scale); var_dump($tileX, $tileY);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(7) int(2)