3v4l.org

run code in 200+ 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 - 7.3.0alpha1
int(7) int(2)