getName()] = $array[0]; unset($array[0]); } return $array; } /** * @param $str * @return array|bool|object * @throws Exception */ public static function isXml($str): object|bool|array { $xml_parser = xml_parser_create(); if (!xml_parse($xml_parser, $str, true)) { xml_parser_free($xml_parser); return false; } else { return self::toArray($str); } } }