A question about Output Buffering in PHP-CLI.
Is it expected that the following code will emit two representations of $x?
I would like to use print_r(), but capature its output in a String, to use
ain a generic logging infrastructure. But every call to print_r(),
var_dump(), var_export(), et. al. goes to STDOUT no matter what I do?
How to I get print_r() to return a string, and not go to STDOUT?
Platform: php-5.0.0RC3 CLI configured/compiled/installed via FreeBSD 5.2.1 ports.
<?php
$x = array('this', 'that', 'the other thing');
ob_start();
print_r($x);
$result = ob_get_flush();
print "$result\n" ;
?>
--
Mark Evenson <ev*****@panix. com>
"A screaming comes across the sky. It has happened before, but there is
nothing to compare to it now." 2 1715
Mark Evenson wrote: A question about Output Buffering in PHP-CLI.
Is it expected that the following code will emit two representations of $x?
I would like to use print_r(), but capature its output in a String, to use ain a generic logging infrastructure. But every call to print_r(), var_dump(), var_export(), et. al. goes to STDOUT no matter what I do?
How to I get print_r() to return a string, and not go to STDOUT?
print_r($array, true);
Berislav
--
If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
Groucho, Chico, and Harpo, then Usenet is Zeppo.
"Berislav Lopac" <be************ @dimedia.hr> writes: Mark Evenson wrote:
[...] How to I get print_r() to return a string, and not go to STDOUT?
print_r($array, true);
Alright. Works! Sorry I missed that in the documentation.
Thanks for your help.
--
Mark Evenson <ev*****@panix. com>
"A screaming comes across the sky. It has happened before, but there is
nothing to compare to it now." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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.
|
by: Alexander DEJANOVSKI |
last post by:
JyRetic 1.0RC3 was just released.
(http://retic.sourceforge.net)
Changes are (I might have forgotten some bug fixes):
- Bug fix : Scheduled events didn't work if no parameter file was required
- Improvement : Speeded up SQL source when there were several records to
extract (~x10)
- Improvement : since JDBC drivers return rowcount on query execution,
there's no need
|
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.
|
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(),
|
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...
| |
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
|
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
|
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.
|
by: coolsti |
last post by:
I am having a curious problem with Vista working on a Lenovo thinkpad.
To test and demonstrate this problem, I have a PHP script that does not terminate. It enters an infinite loop where it repeatedly prints out a line of data, flushes output buffers (with appropriate PHP functions), then sleeps for a number of seconds.
In other words, this represents a constant input stream to the browser which is requesting the script as a page.
On my...
|
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...
|
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,...
| |
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...
|
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,...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |