473,765 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1413
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*******@attgl obal.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
1815
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 scroll "jumps" for a second and goes back to the previous position. I haven't seen it in other scripts. I have no idea what is wrong... I enclose my script full of <br /> index in order to scroll appearance.
2
1582
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 of the tab will give user a specific message when the click on them . When the page load the first tab will be default tab and will be bold . But when user click on the second tab that tab will be bold and rest of them will not bold . In other...
3
7315
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: this.PropertyGrid1.SelectedObject = this.Textbox1; Thank a lot
0
1182
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 significan digits to show in certain rows only. My data source is a DataTable, and it is constructed completely at run-time I want to do the customization AT RUN-TIME, not using VS designer. Is it possible to change the appearance of a particular...
2
1387
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, i.e. different fonts / buttons have different appearance, etc.. I find the 2005 appearance ("Theme") more attractive and modern looking. When I RUN the app, however, the forms take on their "old" appearance, i.e.
3
9614
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. Is there a way to make a script font look as good as my non-script font? Thanks,
3
2375
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 situation with the combo box and text box controls. I setup the text box control appearence settings the way I want the control to appear. Basically, I have set the "Border Style=FixedSingle", which results in the control taking on a flat...
3
3598
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 form gets much smaller. The discrepancy really stands out, and looks like a bug. I anticipate that someone will tell me that the different title bar is intentional -- that showing a different title bar is Windows' way of visually distinguishing...
1
2215
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 database (hosted in SQL server 2005) a great deal of records was filled in the end of many text fields with the string -- script src=http://www.lksr.ru/ngg.js>/script -- and after a week with string &"></title> script...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10160
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.