<?php $in = '1,4|a1,b4'; $pair = explode('|',$in); $out = array_combine(explode(',',$pair[0]),explode(',',$pair[1])); print_r( $out );?>
Standard input is empty
Array ( [1] => a1 [4] => b4 )
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!