I have two scripts. Both scripts are located in the same folder on the same server.
Script 1:
<?php
$text = "Is this not working? Why, yes it is.";
$locale = 'en_US';
$i = IntlBreakIterator::createSentenceInstance($locale);
$i->setText($text);
foreach($i->getPartsIterator() as $sentence) {
echo $sentence . PHP_EOL . '----- next -----' . PHP_EOL;
}
?>
Script 2:
... bunch of other code ...
$doc = file_get_contents("file.txt");
$locale = 'en_US';
$i = IntlBreakIterator::createSentenceInstance($locale);
$i->setText($doc);
foreach($i->getPartsIterator() as $sentence) {
echo $sentence . PHP_EOL . '----- next -----' . PHP_EOL;
}
... bunch of other code ...
Script 1 executes as expected, with the desired output and no errors. Script 2 does not execute and PHP keeps throwing the error PHP Fatal error: Uncaught Error: Class 'IntlBreakIterator' not found
What is going on here?