Q:

Put a space inside array in two-dimensional array

I have two arrays:
$role = isset($_POST['role'])?$_POST['role']:'';
$details = isset($_POST['details'])?$_POST['details']:'';

Output for arrays is:
Role: Array ( [0] => leader [1] => follower ) 
Details: Array ( [0] => lead [1] => follow ) 

I want to assign leader to lead and follower to follow. Then I put two arrays into one:
foreach( $role as $rl => $r ) 
{
  $array_test3[] = array($r, $details[$rl]);
}

Output for print_r($array_test3) is:
Array ( [0] => Array ( [0] => leader [1] => lead ) [1] => Array ( [0] => follower [1] => follow ) ) 

Then I tried to implode an array:
$test3 = implode('<|>',array_map('implode',$array_test3));

Output for echo $test3.'<br/>'; is:
leaderlead<|>followerfollow

But I want is to get the following:
leader<|>lead<|>follower<|>follow

How can I do this?

A:

You need to implode the inner array using the same parameter:
$test3 = implode('<|>',array_map(function ($innerArray) {
   return implode("<|>",$innerArray);
},$array_test3));

Example at: http://sandbox.onlinephpfunctions.com/code/cc6652ada1609ff62379eaac03c6e8cf9ca5a70b

