<?php $string = "12&Shoes&28&Jewelry&30&Watch&96&Beauty&98&Kids&Baby"; var_export( preg_match_all( '/(\d+)&([a-z]+(?:&[a-z]+)?)/i', $string, $m ) ? array_combine($m[1], $m[2]) : [] );
You have javascript disabled. You will not be able to edit any code.