PHP code example of fnull / geohash

1. Go to this page and download the library: Download fnull/geohash library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fnull / geohash example snippets



Geohash\Geohash;

echo Geohash::encode(31.283131, 121.500831); // wtw3uyfjqw61


Geohash\Geohash;

list($lat, $lng) = Geohash::decode('wtw3uyfjqw61');
echo $lat, ', ', $lng; // 31.283131, 121.500831