473,698 Members | 2,611 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 2425
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
2119
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
1924
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
1990
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
2517
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
2707
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
1814
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
1593
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
15551
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
4127
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
8683
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
8610
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
9170
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
9031
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...
0
8873
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7740
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
6528
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
4372
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...
1
3052
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.