PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.25.5
Last Build: August 06, 2019 13:23pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
psShrinkSource()
Shrinks an HTML source string


Description:

I wanted to remove a lot of unwanted chrs, spaces, tabs, newlines,
etc from a web page source. so I came up with this function.



Usage:

$buffer = psShrinkSource($buffer);



Example:

	$buffer = psShrinkSource("<HTML> <BODY> <BR> <BR> </BODY> </HTML>");
// returns "<HTML><BODY><BR><BR></BODY></HTML>"




Code:

function psShrinkSource($buffer)
{
$buffer = ereg_replace("[ \t\n\r]+", " ", $buffer);
$buffer = str_replace("> <meta","><meta",$buffer);
$buffer = str_replace(" <BR>","<BR>",$buffer);
$buffer = str_replace("<BR> ","<BR>",$buffer);
$buffer = str_replace(" <DIV","<DIV",$buffer);

return $buffer;
}


Changlelog:



See Also

And a shot out to:

PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site