- explode: documentation ( source)
- json_encode: documentation ( source)
<?php
$string = "11111*1; 22222*1; 33333*1; 44444*1";
$array = explode('; ', $string);
$new = [];
foreach($array as $k => $v){
$parts = explode('*', $v);
$new[] = [
'sku' => $parts[0],
'qty' => $parts[1],
];
}
echo json_encode($new, JSON_PRETTY_PRINT); // JSON_PRETTY_PRINT is just for displaying it nicely here