public static function fileToArray($file)
    {
        if (! is_file($file) && ! filter_var($file, FILTER_VALIDATE_URL)) {
            self::arrayToFile([], $file);
        }

        $json = @file_get_contents($file);
        $array = json_decode($json, true);
        $lastError = JsonLastError::check();

        return $array === null || !is_null($lastError) ? false : $array;
    }
public static function fileToArray($file)
    {
        if (! is_file($file) && ! filter_var($file, FILTER_VALIDATE_URL)) {
            self::arrayToFile([], $file);
        }

        $json = @file_get_contents($file);
        $array = json_decode($json, true);
        $lastError = JsonLastError::check();

        return $array === null || !is_null($lastError) ? false : $array;
    }
public static function fileToArray ( $ file ) { if ( ! is_file ( $ file ) && ! filter_var ( $ file , FILTER_VALIDATE_URL ) ) { self :: arrayToFile ( [ ] , $ file ) ; } $ json = @ file_get_contents ( $ file ) ; $ array = json_decode ( $ json , true ) ; $ lastError = JsonLastError :: check ( ) ; return $ array === null || ! is_null ( $ lastError ) ? false : $ array ; }
Save to array the JSON file content.

@param string $file → path or external url to JSON file

@return array|false
Save to array the JSON file content .