I have a string composed like this:
87||1|nuovo#88||4|#209|||#89|||#41||1|#5|||#3||1|116#20|||#13||3|#148|||
The pattern is:
Sight change to Jiri's code.
Replace this line
list($id, $mq, $qr, $tipo) = explode('|', $i);
with
list($id[], $mq[], $qr[], $tipo[]) = explode('|', $i);