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
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:

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