Posting array to arrays in php

Im trying to post the implode data of multiple select html to database but it is dynamic.
Result will be like this:

data1|data2|data3 = from multiple select(already get)

how do i achieve this kind of result it separated with commas
data1|data2|data3, data1|data2|data3, data1|data2|data3

the separated data inside the commas are came from another multiple select

here’s my code
html

<div class="required field">
 <label>Subjects:</label>
  <select class="ui fluid search dropdown" name="pass_subj[]" multiple="">
    <option value="">Subject</option>
    <option value="data1">subject1</option>
    <option value="data2">subject2</option>
    <option value="data3">subject3</option>
    <option value="data4">subject4</option>
    <option value="data5">subject5</option>
    </select>
</div>
<div class="two wide field" style="padding: 23px 0px 0px;">
 <button class="passmore ui icon yellow button" type="button"><i class="plus icon"></i></button>
</div>

php

$pass_subj = $_POST['pass_subj'];
$pass_subjs = implode("|", $pass_subj);