I have this code to parse through a remote TXT file. It works fine on a remote server which runs on unix, but on Windows 10 Apache, it does not get to the echo <hr>Reached here...<hr>;
line.
This is the code:
<?php
if (!file_exists('unicode-13.txt')) {
file_put_contents('unicode-13.txt', file_get_contents('https://unicode.org/Public/emoji/13.0/emoji-test.txt'));
}
$blocks = explode(PHP_EOL.PHP_EOL, file_get_contents('unicode-13.txt'));
// var_dump($blocks);
unset($blocks[0]);
$emoji = [];
foreach ($blocks as $chunk) {
echo "<hr>Reached here...<hr>";
$top = explode(PHP_EOL, $chunk)[0];
if (substr($top, 0, strlen('# group:')) == '# group:') {
$group = trim(str_replace('# group:', '', $top));
} elseif (substr($top, 0, strlen('# subgroup:')) == '# subgroup:') {
$lines = explode(PHP_EOL, $chunk);
unset($lines[0]);
foreach ($lines as $line) {
$subgroup = trim(str_replace('# subgroup:', '', $top));
$linegroup = explode(';', $line);
$parts = explode('#', $linegroup[1]);
$icon = explode(' ', trim($parts[1]), 2);
$var_codepoint = trim($linegroup[0]);
$var_status = trim($parts[0]);
$var_sub_group = trim($subgroup);
$var_emoji = trim($icon[0]);
$var_emojiname = trim($icon[1]);
echo "var_codepoint: " . $var_codepoint . "<br />";
echo "var_status: " . $var_status . "<br />";
echo "group: " . $group . "<br />";
echo "var_sub_group: " . $var_sub_group . "<br />";
echo "var_emoji: " . $var_emoji . "<br />";
echo "var_emojiname: " . $var_emojiname . "<hr />";
} // line
} // subgroup
} // foreach
?>
I get no errors on Windows - I have verified that the $blocks
array is populated on the windows test, as a var_dump($blocks);
displays the array.
However, it seems that on windows, none of the code beyond unset($blocks[0]);
is fired / reached.
I get no errors in the windows php error log, so I am not sure what might be going on.