Skip to content

Instantly share code, notes, and snippets.

@ederrafo
Last active July 18, 2021 20:32
Show Gist options
  • Save ederrafo/71594f2588a42dc7620a9ab147a1a2a0 to your computer and use it in GitHub Desktop.
Save ederrafo/71594f2588a42dc7620a9ab147a1a2a0 to your computer and use it in GitHub Desktop.
php read json file
<?php
$string = trim(file_get_contents(dirname(__FILE__) . "/response.json"));
// Remove utf8 sequence
$bom = pack('H*','EFBBBF');
$string = preg_replace("/^$bom/", '', $string);
$data = json_decode($string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment