473,569 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

register_shutdo wn_function and output buffering

Say I have the following PHP script:

<?
register_shutdo wn_function('te st');
ob_start();
echo "part2";

function test()
{
$output = ob_get_contents ();
ob_end_clean();
echo "part1<br />".$output;
}
?>

The output of this is part2part1<br />. Why isn't it part1<br />part2?
register_shutdo wn_function should make the test function be the last
thing that's called, just as it is in the following, shouldn't it?:

<?
ob_start();
echo "part2";
test();

function test()
{
$output = ob_get_contents ();
ob_end_clean();
echo "part1<br />".$output;
}
?>

Jul 17 '05 #1
1 2419
yawnmoth wrote:
Say I have the following PHP script:

<?
register_shutdo wn_function('te st');
ob_start();
echo "part2";

function test()
{
$output = ob_get_contents ();
ob_end_clean();
echo "part1<br />".$output;
}
?>

The output of this is part2part1<br />. Why isn't it part1<br />part2?
register_shutdo wn_function should make the test function be the last
thing that's called, just as it is in the following, shouldn't it?:

<?
ob_start();
echo "part2";
test();

function test()
{
$output = ob_get_contents ();
ob_end_clean();
echo "part1<br />".$output;
}
?>


Maybe because test() is called when the rest of the code is complete
(shutdown)?

Looks like the correct output to me.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 17 '05 #2

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

Similar topics

1
2111
by: | last post by:
Hi all ! I am using register_shutdown_function. It behaves something strange. register_shutdown_function("f1"); register_shutdown_function("f2"); they fire in sequence f1
2
1909
by: Joshua Beall | last post by:
Hi All, I use register_shutdown_function to register a function that then gets run when the script finishes executing. It worked great before, but sometime last week on my development server all my sites started going very slowly. It is still running fine on the production server (thankfully). Nothing was changed. In fact, I was out of...
2
1982
by: vishal | last post by:
hi vishal here. can anyone tell me that how to buffer output and then send the output to client at a time. what is my problem is that i have a php file which runs query on database and takes some time to get query result. so what i want is i want to buffer output till the query returns result and then send the buffered output to client...
1
2515
by: Tim Mohler | last post by:
All - I have a script that provides a web page interface to various system utilities. Once the user has selected the utility and input various parameters, it calls itself with a different method and input value, for instance ping. During the initial call, the output is not buffered, but on the second call, the actually executes the...
9
2702
by: Fred Ma | last post by:
Hello, I posted previously under the thread: How to break this up into streambuf/ostream I've asked our library to get "C++ IOStreams and Locales..." by A. Langer et al. Meantime, I've looked at the C++ standard (ISO/IEC 14882) from the web to get a grip on the relationship between ostream methods and streambuf methods: flush(),...
15
1806
by: jools | last post by:
I'm having trouble modifying some code written by someone else. The code is very dense and obscure but does work fine. However I need to insert a block of my own and I've hit what I assume is a buffering problem.(If there's another answer I'd be grateful ...) The problem is PHP is refusing to do things in the correct sequence. I've tried...
4
1592
by: Grant Edwards | last post by:
When I ssh in to my Windows XP box and run Python apps, output from "print" and and "sys.stdout.write()" is being buffered so that none of the output shows up until the program exits. From within my program how do I set output buffering to either line-buffered or un-buffered? -- Grant Edwards grante Yow!...
25
15531
by: Abubakar | last post by:
Hi, recently some C programmer told me that using fwrite/fopen functions are not efficient because the output that they do to the file is actually buffered and gets late in writing. Is that true? regards, ...ab
5
4118
by: thedsadude | last post by:
Hello, I'm launching a script as follows: <code> p = subprocess.Popen() p.wait() </code> If p.py writes to sys.stdout, then it is shown on the console.
0
7703
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...
0
7618
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...
0
7926
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. ...
0
8132
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...
1
7678
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...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.