I have this code snippet:
foreach ($data as $key => $value) { $result = $this->_restFetch($value); $mode[$key] = $result[0]->extract; } Just some basic code that runs in a for loop sending a request to some API. It takes time to finish the script, so I'd like to output some text to the user while the script is executing, something like bellow:
foreach ($data as $key => $value) { print "Started importing $value \r\n"; $result = $this->_restFetch($value); $mode[$key] = $result[0]->extract; print "Finished importing $value \r\n"; } I've tried various approached with ob_ commands but none of them worked. Any ideas?
$value? array? string?flush()after every line to be printed.