All pastes #801716 Raw Edit

Something

public text v1 · immutable
#801716 ·published 2007-11-29 15:07 UTC
rendered paste body
<?php
    function data($parser, $data){
        //echo $data;
        if(strtolower($data)==strtolower($_POST['quick']))
        {
            echo "we got a match $data<br>";
        }
    }
    
    function startElement($parser, $data, $ary){
        array_push($ary, $data);
    }
    
    function endElement($parser, $data){
        
    }
    
    $starttimer = time()+microtime();

    $file = "db.xml";
    
    $ary=array();
    
    $xml_parser = xml_parser_create();
    
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    
    xml_set_character_data_handler($xml_parser, "data");
    
    $fp = fopen($file, "r");
    
    $data = fread($fp, 80000);
    
    if(!(xml_parse($xml_parser, $data, feof($fp)))){
        die("Error on line " . xml_get_current_line_number($xml_parser));
    }
    
    xml_parser_free($xml_parser);
    
    fclose($fp);
    
    
    $stoptimer = time()+microtime();

    $timer = round($stoptimer-$starttimer,4);

    echo "Search completed in $timer seconds.";

?>