Forum Moderators: coopster
if you've got an array that comes from a $_POST like this:
Array ( [apples] => 1 [oranges] => 1 [bananas] => 1 )
is there a way to parse the keys OR values into a comma-delimited list which is then fed into a $var?
Like: $someVar = somefunction($myArray); which, when echoed might look like this: apples,oranges,bananas?
I've looked at functions like extract() but I don't have a need for key names to be transformed into individual $vars - I just need keys or values into a var seperated by commas so that I can explode that $var for another use.
I know I could probably just do a foreach() to get this result, but would just like to know if there's already a php function that would do the job.
Neophyte
$post_keys = implode(',', array_keys($_POST));