<?php $str = '1,4|a1,b4'; $out = call_user_func_array("array_combine", array_chunk(str_word_count($str, 1, '1234567890'), 2)); 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!