PHP Salt


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

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

psFileKeyValWrite()
Write Key=Value to txt file


Description:

This will write an array in key = val format to a text file



Usage:


psFileKeyValWrite($fName,$ary,{$sepertor})



Example:


$table['name'] = "Jon";
$table['ID'] = "A60244";
psFileKeyVal("/tmp/somefile.txt",$table);

/tmp/somefile.txt will have:
name=Jon
ID=A60244





Code:


function psFileKeyValWrite($wFile,$ary,$s="=")
{
$fp = fopen($wFile,"w");
foreach ($ary as $key=>$val)
{
fwrite($fp,"{$key}{$s}{$val}\r\n");
}
fclose($fp);
}

Changlelog:


And a shot out to:

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