1<?php
2$ents = file($argv[1],FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
3$entities = array();
4foreach($ents as $ent) {
5  list($char,$num,$name) = preg_split('/\s+/',$ent);
6  $entities[$name]=$num;
7}
8echo count($entities) . "\n";
9$ents_2 = file($argv[2],FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
10foreach($ents_2 as $ent) {
11  list($num,$name) = preg_split('/\s+/',$ent);
12  $entities[$name]=$num;
13  }
14echo count($entities) . "\n";
15
16$entities = serialize($entities);
17file_put_contents('epub_ents.ser', $entities);
18
19exit;
20
21$epub_ents = unserialize(file_get_contents('epub_ents.ser'));
22print_r($epub_ents);