PHP Salt


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

Version: 2.30.2
Last Build: September 02, 2021 09:55am (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
db
file
graph
html
mail
math
misc
mobile
script
string
system
time
web
psAryToString()
Returns a string from an array, including keys/val


Description:

This function will create a long string with key/val pairs and seperated by a delimter.
Default delimter is " | "
Note: this does not recurse sub arrays



Usage:

$str = psAryToStr($ary, $delimiter);



Example:

	$ary = { "col1" => "left", "col2" => "right" }
$str = psAryToStr($ary); // returns "col1=left | col2=right";





Code:

function psAryToStr($ary,$d="|")
{
$res = "";
foreach ($ary as $key=>$val)
{
if ($res != "") { $res .= " {$d} "; }
$res .= "{$key}={$val}";
}
return $res;
}


Changlelog:


See Also

  psStrToAry()
And a shot out to:

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