How do I convert an array according to one of its value
<p>I am not good at playing with array. So I really need your help.
I got an array like this one: </p>

<pre><code>array(1) {
[0]=&gt;
array(5) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["assignedlessons"]=&gt;
string(16) "222|69|308|50|91"
["lesson"]=&gt;
array(5) {
  [0]=&gt;
  string(3) "222"
  [1]=&gt;
  string(2) "69"
  [2]=&gt;
  string(3) "308"
  [3]=&gt;
  string(2) "50"
  [4]=&gt;
  string(2) "91"
}
}
}
</code></pre>

<p>What I want to do is to write a function to convert it to(remove ['assignedlessons'] and split the array according to lesson:</p>

<pre><code>array(5) {
[0]=&gt;
array(4) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["lesson"]=&gt;
array(1) {
  [0]=&gt;
  string(3) "222"
 }
} 
[1]=&gt;
array(4) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["lesson"]=&gt;
array(1) {
  [0]=&gt;
  string(2) "69"
 }
} 
[2]=&gt;
array(4) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["lesson"]=&gt;
array(1) {
  [0]=&gt;
  string(3) "308"
 }
} 
[3]=&gt;
array(4) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["lesson"]=&gt;
array(1) {
  [0]=&gt;
  string(2) "50" 
 }
} 
[4]=&gt;
array(4) {
["first_name"]=&gt;
string(3) "Bob"
["last_name"]=&gt;
string(6) "Gorsky"
["date_of_birth"]=&gt;
string(10) "1954-04-27"
["lesson"]=&gt;
array(1) {
  [0]=&gt;
  string(2) "91"
 }
} 
}
</code></pre>
