PHP | xml_parser_get_option() Function Last Updated : 31 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Pre-requisite: XML Basics The xml_parser_get_option() function is an inbuilt function in PHP which retrieves the options from an XML parser. Syntax: mixed xml_parser_get_option( resource $parser, int $specified_option ) Parameters: This function accepts two parameters as mentioned above and described below: $parser: It is required parameter. It specifies the XML parser whose options to be retrieved. $specified_option: It is required parameter (integer). It specifies the options to be retrieved from specified parser. Possible values of the parameters are: XML_OPTION_CASE_FOLDING: It is used to specify the case-folding. If it enables then it returns 1 and if it disables then it returns 0. XML_OPTION_TARGET_ENCODING: It is used to specify the target encoding in the specified XML parser. It returns the name of the encoding (US-ASCII, UTF-8 or ISO-8859-1 etc). XML_OPTION_SKIP_TAGSTART: It is used to specify the number of characters skipped in the beginning of a tag name. XML_OPTION_SKIP_WHITE: It is used to specify if values consisting of whitespace characters are skipped or not. It returns 1 if skipped and 0 otherwise. Return Value: This function returns the value of specified option on success or False on failure. Note: This function is available for PHP 4.0.0 and newer version. Option parameters XML_OPTION_SKIP_TAGSTART and XML_OPTION_SKIP_WHITE will work for PHP 7.1.0 and newer versions only. Program 1: php <?php // Creating an XML parser $parser = xml_parser_create(); echo "This example illustrates how xml_parser_get_option()" . " function works<br>"; echo "XML_OPTION_CASE_FOLDING: " . xml_parser_get_option( $parser, XML_OPTION_CASE_FOLDING) ."<br>"; // Free to XML parser xml_parser_free($parser); ?> Output: This example show how xml_parser_get_option() function works XML_OPTION_CASE_FOLDING: 1 Program 2: php <?php // Create an XML parser $parser = xml_parser_create(); // Getting the option for all possible options echo "option = XML_OPTION_CASE_FOLDING: " . xml_parser_get_option($parser, XML_OPTION_CASE_FOLDING) ."<br>"; echo "option = XML_OPTION_TARGET_ENCODING: " . xml_parser_get_option($parser, XML_OPTION_TARGET_ENCODING) ."<br>"; echo "option = XML_OPTION_SKIP_TAGSTART: " . xml_parser_get_option($parser, XML_OPTION_SKIP_TAGSTART) ."<br>"; echo "option = XML_OPTION_SKIP_WHITE: " . xml_parser_get_option($parser, XML_OPTION_SKIP_WHITE); // Free to XML parser xml_parser_free($parser); ?> Output: option = XML_OPTION_CASE_FOLDING: 1 option = XML_OPTION_TARGET_ENCODING: UTF-8 option = XML_OPTION_SKIP_TAGSTART: 0 option = XML_OPTION_SKIP_WHITE: 0 Reference: https://www.php.net/manual/en/function.xml-parser-get-option.php Comment More infoAdvertise with us Next Article PHP | xml_parser_set_option() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-XML Similar Reads PHP | xml_parser_set_option() Function Pre-requisite: XML Basics The xml_parser_set_option() function is an inbuilt function in PHP which is used to set the options in an XML parser. Syntax: bool xml_parser_set_option( resource $parser, int $specified_option, mixed $option_value) Parameters: This function accepts three parameters as ment 2 min read PHP | xml_parse() Function The xml_parse() function is an inbuilt function in PHP which is used to parse XML document. Syntax:Â int xml_parse( resource $xml_parser, string $xml_data, bool $is_final ) Parameter: This function accepts three parameters as mentioned above and described below:Â Â $xml_parser: It is required paramet 3 min read PHP | xml_parser_create_ns() Function The xml_parser_create_ns() function is an inbuilt function in PHP which is used to create an XML parser with namespace support and returns the resource handle. Syntax:Â resource xml_parser_create_ns( string $encoding, string $separator ) Parameters: This function accepts two parameters as mentioned 2 min read PHP | Imagick getOption() Function The Imagick::getOption() function is an inbuilt function in PHP which is used to get a value associated with the specified key. Syntax: string Imagick::getOption( string $key ) Parameters: This function accepts a single parameter $key which holds the name of option. Return Value: This function retur 1 min read PHP | xml_parse_into_struct() Function The xml_parse_into_struct() function is an inbuilt function in PHP which is used to parse XML data into an array structure. The XML data are parsed into two parallel array structures, first one is index array that contains pointers to the location of the values in the value array and second one is v 4 min read PHP | xml_parser_free() Function Pre-requisite: XML BasicsThe xml_parser_free() function is an inbuilt function in PHP which is used to free the XML parser. Syntax:Â Â bool xml_parser_free( resource $parser ) Parameters: This function accepts single parameter $parser which is required. It specifies the reference of XML parser to fre 3 min read Like