Is there any way to remove automatically all blank chars from the html
sent to the client??
Example:
----------------------------------------------------------------
<?
echo "HTML tags here<br>" ;
?>
more HTML here
<div>
<div>
Some text
</div>
</div>
<?
----------------------------------------------------------------
after running this php script the client should receive:
----------------------------------------------------------------
HTML tags here<br>
more HTML here
<div>
<div>
Some text
</div>
</div>
----------------------------------------------------------------
Is there any option in PHP to do this automatically??
Thanks in advance. 10 1647
On 7 Oct 2006 14:51:36 -0700, He*************@gmail.com wrote:
>Is there any way to remove automatically all blank chars from the html sent to the client??
Example: ---------------------------------------------------------------- <? echo "HTML tags here<br>" ; ?> more HTML here <div> <div> Some text </div> </div>
<? ----------------------------------------------------------------
after running this php script the client should receive: ---------------------------------------------------------------- HTML tags here<br> more HTML here <div> <div> Some text </div> </div> ----------------------------------------------------------------
Is there any option in PHP to do this automatically??
Not built-in, but you could use output buffering and modify the contents of
the buffer as it's output. http://uk2.php.net/manual/en/ref.outcontrol.php
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Thanks.
Is there any performance impact or server overloading if I use output
buffering??
Does it take more resources (cpu, ram)??
On Oct 7, 6:59 pm, Andy Hassall <a...@andyh.co.ukwrote:
On 7 Oct 2006 14:51:36 -0700, Hermann.Rich...@gmail.com wrote:
Is there any way to remove automatically all blank chars from the html
sent to the client??
Example:
----------------------------------------------------------------
<?
echo "HTML tags here<br>" ;
?>
more HTML here
<div>
<div>
Some text
</div>
</div>
<?
----------------------------------------------------------------
after running this php script the client should receive:
----------------------------------------------------------------
HTML tags here<br>
more HTML here
<div>
<div>
Some text
</div>
</div>
----------------------------------------------------------------
Is there any option in PHP to do this automatically?? Not built-in, but you could use output buffering and modify the contents of
the buffer as it's output.
http://uk2.php.net/manual/en/ref.outcontrol.php
--
Andy Hassall :: a...@andyh.co.uk ::http://www.andyh.co.ukhttp://www.and....co.uk/space:: disk and FTP usage analysis tool- Hide quoted text -- Show quoted text -
Following on from 's message. . .
>Thanks.
Is there any performance impact or server overloading if I use output buffering??
Does it take more resources (cpu, ram)??
No there is absolutely no overhead when buffering and processing the
buffer. Why should that be? It's not as if you're using RAM or CPU
cycles.
If you're generating the output dynamically then clear out those spaces
in the source code.
If you are just serving HTML then tidy up the original HTML once.
--
PETER FOX Not the same since the e-commerce business came to a . pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Peter Fox wrote:
Following on from 's message. . .
>Thanks.
Is there any performance impact or server overloading if I use output buffering??
Does it take more resources (cpu, ram)??
No there is absolutely no overhead when buffering and processing the
buffer. Why should that be? It's not as if you're using RAM or CPU
cycles.
If you're generating the output dynamically then clear out those spaces
in the source code.
If you are just serving HTML then tidy up the original HTML once.
Actually, there is a slight performance hit, but it isn't much.
PHP will by default buffer the output, But this is not a huge buffer(I
forget the size),and when it fills, the output is sent to the web server.
If you use output buffering, all the output is buffered until you send
the data on. This will generally require more RAM for the larger
buffer, and more CPU cycles to process the buffer.
But it's not a great amount unless you have large pages.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
My pages are not too big. But I'm expecting to receive a lot amount of
visits so I'm very concerned about performance because a slight
overhead in processing a page could have a big impact on the server
when serving hundreds of requests per second.
What do you think??
Could there be a noticeable impact in server's performance on a very
visited site??
Thank you all for your replies.
On Oct 9, 9:21 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
Peter Fox wrote:
Following on from 's message. . .
Thanks.
Is there any performance impact or server overloading if I use output
buffering??
Does it take more resources (cpu, ram)??
No there is absolutely no overhead when buffering and processing the
buffer. Why should that be? It's not as if you're using RAM or CPU
cycles.
If you're generating the output dynamically then clear out those spaces
in the source code.
If you are just serving HTML then tidy up the original HTML once.Actually, there is a slight performance hit, but it isn't much.
PHP will by default buffer the output, But this is not a huge buffer(I
forget the size),and when it fills, the output is sent to the web server.
If you use output buffering, all the output is buffered until you send
the data on. This will generally require more RAM for the larger
buffer, and more CPU cycles to process the buffer.
But it's not a great amount unless you have large pages.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -- Show quoted text -
He*************@gmail.com wrote:
On Oct 9, 9:21 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Peter Fox wrote:
>>>Following on from 's message. . .
>>>>Thanks.
>>>>Is there any performance impact or server overloading if I use output buffering??
>>>>Does it take more resources (cpu, ram)??
>>>No there is absolutely no overhead when buffering and processing the buffer. Why should that be? It's not as if you're using RAM or CPU cycles.
>>>If you're generating the output dynamically then clear out those spaces in the source code.
>>>If you are just serving HTML then tidy up the original HTML once.Actually, there is a slight performance hit, but it isn't much.
PHP will by default buffer the output, But this is not a huge buffer(I forget the size),and when it fills, the output is sent to the web server.
If you use output buffering, all the output is buffered until you send the data on. This will generally require more RAM for the larger buffer, and more CPU cycles to process the buffer.
But it's not a great amount unless you have large pages.
My pages are not too big. But I'm expecting to receive a lot amount of
visits so I'm very concerned about performance because a slight
overhead in processing a page could have a big impact on the server
when serving hundreds of requests per second.
What do you think??
Could there be a noticeable impact in server's performance on a very
visited site??
Thank you all for your replies.
(Top posting fixed)
Yes, it can affect performance. The reason being that if you don't use
output buffering, PHP can send data to the web server (and onto the
client) while the page is being built. As soon as a buffer gets full,
PHP sends it to the web server; the web server may send it immediately
or buffer it further, but eventually it will send it to the client.
Using the output buffering functions means PHP will have to buffer
everything, then later send everything to the web server at once. Then
the web server sends it to the client.
So not only does this take more memory, it slows things down because PHP
and the web server cannot pick the most opportune times to pass the data on.
With all of that - normally it's not a significant delay, however.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Following on from Jerry Stuckle's message. . .
[Top posting to annoy dimwits who can't cope with posting wherever is
most appropriate.]
You failed to answer the OP's question. He wants to know _exactly_, in
numbers and based on things like 'a lot' what the performance hit will
be. You've had two tries at it - strangely without success: Any reason
for that failure do you think?
> (Top posting fixed)
[But you didn't think of snipping - Duh! - Repeat after me: "Threaded
newsreader"]
> Yes, it can affect performance. The reason being that if you don't use output buffering, PHP can send data to the web server (and onto the client) while the page is being built. As soon as a buffer gets full, PHP sends it to the web server; the web server may send it immediately or buffer it further, but eventually it will send it to the client.
Using the output buffering functions means PHP will have to buffer everything, then later send everything to the web server at once. Then the web server sends it to the client.
So not only does this take more memory, it slows things down because PHP and the web server cannot pick the most opportune times to pass the data on.
With all of that - normally it's not a significant delay, however.
--
PETER FOX Not the same since the statuette business went bust pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
On 9 Oct 2006 17:06:32 -0700, He*************@gmail.com wrote:
>My pages are not too big. But I'm expecting to receive a lot amount of visits so I'm very concerned about performance because a slight overhead in processing a page could have a big impact on the server when serving hundreds of requests per second.
What do you think?? Could there be a noticeable impact in server's performance on a very visited site??
Perhaps it's worth stepping back a little and asking what is your goal here -
why do you want to remove the whitespace?
If the main goal is to reduce the amount of data transferred from server to
client, you may be better off using output compression (e.g. setting
zlib.output_compression to On or a value for the buffer size). Not only will
this compress the whitespace down, it'll transparently compress all the other
text as well. Reductions of 10:1 for the amount of data transferred are not
uncommon. And as this is done in a compiled library then it will likely fare
well compared with doing string processing in PHP to remove whitespace.
But perhaps you have another reason, so it may be useful to hear it.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Peter Fox wrote:
Following on from Jerry Stuckle's message. . .
[Top posting to annoy dimwits who can't cope with posting wherever is
most appropriate.]
You failed to answer the OP's question. He wants to know _exactly_, in
numbers and based on things like 'a lot' what the performance hit will
be. You've had two tries at it - strangely without success: Any reason
for that failure do you think?
>> (Top posting fixed)
[But you didn't think of snipping - Duh! - Repeat after me: "Threaded
newsreader"]
Poor troll doesn't follow conventions.
I didn't answer exactly because there is no exact answer - which you
would know if you had any understanding of systems and how PHP and
Apache work.
It depends on too many things. CPU speed, amount of available memory,
PHP and Apache options, size of pages being buffered, number of pages
being buffered, even ping times and link speed on the client end.
And a whole bunch more.
But I repeat - for most systems it should not be a significant slowdown.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Thank you, Andy and Jerry.
My reasons to remove blanks chars (\n, \r, \t, space) are basicly that
I want to reduce bandwidth usage and to add some kind of obfuscation to
my codes.
I think that the zlib.compression thing will do it for the bandwidth
usage.
For the obfuscation, I think I still will have to use output buffering.
Jerry Stuckle wrote:
Peter Fox wrote:
Following on from Jerry Stuckle's message. . .
[Top posting to annoy dimwits who can't cope with posting wherever is
most appropriate.]
You failed to answer the OP's question. He wants to know _exactly_, in
numbers and based on things like 'a lot' what the performance hit will
be. You've had two tries at it - strangely without success: Any reason
for that failure do you think?
>
(Top posting fixed)
[But you didn't think of snipping - Duh! - Repeat after me: "Threaded
newsreader"]
Poor troll doesn't follow conventions.
I didn't answer exactly because there is no exact answer - which you
would know if you had any understanding of systems and how PHP and
Apache work.
It depends on too many things. CPU speed, amount of available memory,
PHP and Apache options, size of pages being buffered, number of pages
being buffered, even ping times and link speed on the client end.
And a whole bunch more.
But I repeat - for most systems it should not be a significant slowdown.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: john |
last post by:
I am using this to remove everything except the 0-9 and a-z characters,
but I also want to remove blanks spaces as well(yes even ones in
between words)
$strippedtext =...
|
by: Registered User |
last post by:
Hi experts,
I'm trying to write a program that replaces two or more consecutive
blanks in a string by a single blank.
Here's what I did:
#include <stdio.h>
#include <string.h>
#define MAX 80
|
by: eBob.com |
last post by:
I have a RichTextBox in which I'd like blanks to appear different from
nothing. Imagine a file which does not fill up the RTB. You can't tell how
many, if any, blanks might follow the last...
|
by: Sam |
last post by:
Could someone help me by providing a formula that will change the
formatting, in a query of a phone number.. The data in the table is
formatted as (123) 456-7890. I need the field to be 123456789...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |