- array_chunk: documentation ( source)
- print_r: documentation ( source)
- explode: documentation ( source)
<?php
$str = '33|ts|6|ank|5|ist|4|bjk|2|fb|1|gs';
$explode = explode('|', $str);
$parcala = array_chunk($explode, 2);
$arr = [];
foreach ($parcala as $item) {
$arr[$item[0]] = $item[1];
}
print_r($arr);