3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once 'vendor/autoload.php'; use GeoIp2\Database\Reader; $reader = new Reader('/path/to/GeoIP2-City.mmdb'); $address = clientIpAddress(); $record = $reader->city($address); echo "<br>Country: ". $record->country->name; echo "<br>City: ". $record->city->name; echo "<br>Latitude: ". $record->location->latitude; echo "<br>Longitude: ". $record->location->longitude; ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: require_once(): open_basedir restriction in effect. File(vendor/autoload.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/vBmdt on line 2 Warning: require_once(vendor/autoload.php): Failed to open stream: Operation not permitted in /in/vBmdt on line 2 Fatal error: Uncaught Error: Failed opening required 'vendor/autoload.php' (include_path='.:') in /in/vBmdt:2 Stack trace: #0 {main} thrown in /in/vBmdt on line 2
Process exited with code 255.

preferences:
53.95 ms | 402 KiB | 62 Q