I have an array like the one below, which actually collects login and other data from a user submitted form, to be written to a DB. I don't need all the form data, and hence this approach.
$array['a'] = $_POST['userName'];
$array['a'] .= $_POST['passWord'];
Which results in:
$array['a'] = '[email protected]';
$array['a'] .= 'password';
I'm trying to get values from the array as a string, sperated by , or ::, but just cannot figure how to do it.
Using implode gives me a continious string like [email protected]
$comma_separated = implode($array);
echo $comma_separated;
Is it somehow possible to get a string like ::[email protected] ::passpword from the array without a for loop.
The approach cannot be changed since it's already in a working site.
I'm using PHP 7.0 on a Windows 10 Machine for testing.