473,395 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

php script appearance in the time

Hello,

This is a simple script I test in a browser (firefox & opera) :

echo "test 1<br />" ;
sleep(3);
echo "test 2<br />" ;

I expected to see "test 1" appearing first and then "test 2" 3 sec after.
Still, I got "test 1" & "test 2" appearing "in one shot" after 3 seconds.
How can I get what I expected (I precised in a browser because there's no pb
in a command line execution) ?

Thanks in advance,

Lionel
Aug 15 '07 #1
5 1399
lionel wrote:
Hello,

This is a simple script I test in a browser (firefox & opera) :

echo "test 1<br />" ;
sleep(3);
echo "test 2<br />" ;

I expected to see "test 1" appearing first and then "test 2" 3 sec after.
Still, I got "test 1" & "test 2" appearing "in one shot" after 3 seconds.
How can I get what I expected (I precised in a browser because there's no pb
in a command line execution) ?

Thanks in advance,

Lionel
Try this

echo "test 1<br />" ;
ob_flush();
flush();
sleep(3);
echo "test 2<br />" ;

Arjen
www.arjenkarel.nl

Aug 15 '07 #2
Try this
>
echo "test 1<br />" ;
ob_flush();
flush();
sleep(3);
echo "test 2<br />" ;

Arjen
www.arjenkarel.nl

It nearly works, I got a notice message. Adding "on_start();" at the
beginning makes it disappear.
Thank you.
Lionel
Aug 15 '07 #3
On 15.08.2007 08:42 Arjen wrote:
lionel wrote:
>Hello,

This is a simple script I test in a browser (firefox & opera) :

echo "test 1<br />" ;
sleep(3);
echo "test 2<br />" ;

I expected to see "test 1" appearing first and then "test 2" 3 sec after.
Still, I got "test 1" & "test 2" appearing "in one shot" after 3 seconds.
How can I get what I expected (I precised in a browser because there's
no pb in a command line execution) ?

Thanks in advance,

Lionel

Try this

echo "test 1<br />" ;
ob_flush();
flush();
sleep(3);
echo "test 2<br />" ;

Arjen
www.arjenkarel.nl
not ob_flush, just flush()
--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Aug 15 '07 #4
lionel wrote:
Hello,

This is a simple script I test in a browser (firefox & opera) :

echo "test 1<br />" ;
sleep(3);
echo "test 2<br />" ;

I expected to see "test 1" appearing first and then "test 2" 3 sec after.
Still, I got "test 1" & "test 2" appearing "in one shot" after 3 seconds.
How can I get what I expected (I precised in a browser because there's no pb
in a command line execution) ?

Thanks in advance,

Lionel

You can't do it reliably.

You can control what your code does. You can even control the PHP
buffering. But you can't control buffering in the web server, which may
delay the output until the buffer fills or the entire page is sent. You
also cannot control the browser, which may delay displaying the data
until the entire page is received.

You can flush buffers and get it to work much of the time. But not
necessarily all the time.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 15 '07 #5
You can't do it reliably.
>
You can control what your code does. You can even control the PHP
buffering. But you can't control buffering in the web server, which may
delay the output until the buffer fills or the entire page is sent. You
also cannot control the browser, which may delay displaying the data until
the entire page is received.

You can flush buffers and get it to work much of the time. But not
necessarily all the time.
Thanks for this precision.

Lionel
Aug 15 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Mario | last post by:
I wrote a tooltips script. I've noticed "small" problem occuring while using the IE browser. If a site is long enough for a scroll to appear and we move the mouse indicator on the link then the...
2
by: . . | last post by:
Hi I need to have some help with the Java Script and wonder if some one of you could help me out . I have a aspx page where I have four Tabs on the top of the page for the user to click . Each...
3
by: Nicolas | last post by:
I want to display in my application a PropertyGrid showing only the "Appearance" of a control (ie. textBox) so the user can change it. Bare with me, I'm new in csharp. Where do I go from:...
0
by: Maria | last post by:
Hi I am new to .NET and would like to know how do we customize the apprearance of a datagrid Precisely, I would like to make ONE row appear in BOLD, and I would like to specify the number of...
2
by: Grumpy Aero Guy | last post by:
I have upgraded an extensive solution to VS 2005 from VS2003 ... no problems. I notice that in VS2005, the forms, when viewed in design mode, have a different appearance than they did in 2003,...
3
by: Hymer | last post by:
Hello, I used CSS to specify a line of type in Times New Roman, Italic. I notice that the font seems to not be dithered on the webpage. That is, the font looks a little ragged around the edges....
3
by: =?Utf-8?B?R3JlZw==?= | last post by:
I am used to using third party controls when it comes to setting up appearences. But, now I am using Visual Basic.Net controls that come standard with the product. I've come across a frustration...
3
by: TC | last post by:
I have a form which I'd like to display as a sizable dialog box. The behavior I get when I use FormBorderStyle = SizableToolWindow is perfect. However, when I use that option, the title bar of my...
1
by: stefmpiz | last post by:
Hello, i am a new member from Greece. I am administrator of a website and recently i had two similar virus problems. Suddenly before two weeks i found out that in many of the tables of my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.