Showing output while parsing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Showing output while parsing

Post by Cruzado_Mainfrm »

is it possible that u can send output to the browser while the php engine is parsing the code? like:

Code: Select all

<?php
echo "Initializing";
//do a lot of stuff, like loops and everything, which takes long time
echo "Done";
?>


Initializing has to be shown first, then we the process finishes "Done" is sent to the browser, meaning the script has ended at that time.

what are the functions to do this? is it output something? can this be done? if so, a little example or tutorial on how to do this will be appreciated

is it flush() or something like that??
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

it takes a long time to parse the code?
If you refer to "execute the code" then ,yes, flush() is probably what you're looking for.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

yeah i'm making a spider that crawls lyric websites, and this takes loooong... so i want to output very echo saying: "Now displaying songs for artist $artist" and things of that nature :D thnx volka :D
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Must note the similiar usage of ob_flush if you are using output buffering.
Post Reply