PHP code example of medcore-ua / nk-025-2021-parser

1. Go to this page and download the library: Download medcore-ua/nk-025-2021-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

medcore-ua / nk-025-2021-parser example snippets




edCore\Nk0252021Parser\Parser;

$parser = new Parser();

try {
    $classifications = $parser->parse();

    // Iterate over all classifications
    foreach ($classifications as $classification) {
        echo $classification->name_ua . PHP_EOL;
    }

    // Get the total count
    echo "Total classifications: " . count($classifications) . PHP_EOL;

} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}



// ...

$cholera = $parser->findByCode('A00');
echo $cholera->name_ua; // Холера

$choleraBiotar = $parser->findBySpecificCode('A00.0');
echo $choleraBiotar->name_ua; // Холера, спричинена холерним вібріоном 01, biovar cholera



// ...

$results = $parser->searchByName('тиф');

foreach ($results as $result) {
    echo $result->specific_code . ': ' . $result->specific_name_ua . PHP_EOL;
}