for($i = 0; $i < 5; $i++) {
echo $i . "\n";
sleep(1);
}
This is the code I run. Instead of showing a number each second, the php CLI decides to wait and after everything is executed shows
0
1
2
3
4
Why is this happening, how can I make it "real-time" ?
EDIT: Found the problem: because I included WP-Core (Wordpress) the output somehow buffered, if I remove the wp-core it is all fine. For more info, when including the wp_core there are some wp notices that are being logged in separate file.