473,748 Members | 4,697 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 2429
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
2122
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
1928
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 town that week, and the dev server was powered off.
2
1993
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 at a time.
1
2519
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 utility, output is buffered until the command completes.
9
2716
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(), operator<<(), sputc(),
15
1815
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 all the variations of flushing I can think of without success. Can anyone suggest how I can force...
4
1597
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! I'm rated PG-34!! at
25
15563
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
4131
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
8984
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
9530
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
9363
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
9312
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
8237
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...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4593
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.