- print_r: documentation ( source)
- explode: documentation ( source)
- array_filter: documentation ( source)
<?php
$result_array = array();
$str = "1=>aaabba;4=>bsbsbsb;7=>flkdsl;5=>jdsfkjhsfd;";
$temp_array = explode(";",$str);
$temp_array = array_filter($temp_array);
foreach($temp_array as $val)
{
$sub_temp_array = explode("=>",$val);
$result_array[$sub_temp_array[0]] = $sub_temp_array[1];
}
print_r($result_array);