PHP Salt


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

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
web
psTaggedFile()
Simple tagged file


Description:

Returns a simple tagged file to array



Usage:

$ary = psTaggedFileRead($wFile);



Example:







Code:

function psTaggedFileRead($wFile)
{
$buffer = array();
$aryLines = @file($wFile);
if ( is_array($aryLines) == true)
{
foreach ($aryLines as $line)
{
$line = str_replace("\r","",$line);
$line = str_replace("\n","",$line);
if (substr($line,0,1) == "<" && substr($line,-1) == ">")
{
if (substr($line,0,2) != "</")
{
$et = strpos($line,">",1);
//$curTag = $line;
$curTag = substr($line,1,($et-1));
$el = (strlen($curTag) + 3) * -1;
if (substr($line, $el) == "</{$curTag}>")
{
$line = str_replace("<{$curTag}>","",$line);
$line = str_replace("</{$curTag}>","",$line);
$buffer[$curTag] = $line;
$curTag = "";
}
}
}
else
{
if ( $curTag !="" ) { $buffer[$curTag][] = $line; }
}
}
}

return $buffer;
}


Changlelog:


See Also

And a shot out to:

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