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