PHP Salt


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

Version: 2.14.1
Last Build: March 10, 2017 13:28pm (PST)

psTaggedFile()
Simple tagged file


Description:

Returns a simple tagged file to array


Usage:

$ary = psTaggedFileRead($wFile);


Example:






Code:

function psTaggedFileRead($wFile)
{
$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) == "")
{
$line = str_replace("<{$curTag}>","",$line);
$line = str_replace("","",$line);
$buffer[$curTag] = $line;
$curTag = "";
}
}
}
else
{
if ( $curTag !="" ) { $buffer[$curTag][] = $line; }
}
}
}

return $buffer;
}

Changlelog:


See Also

And a shot out to:

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