说我有以下字符串
$str = "once in a great while a good-idea turns great";
使用数组键作为单词开始位置的字符串计数来创建数组的最佳解决方案是什么?
$str_array['0'] = "once";
$str_array['5'] = "in";
$str_array['8'] = "a";
$str_array['10'] = "great";
$str_array['16'] = "while";
$str_array['22'] = "a";
$str_array['24'] = "good-idea";
$str_array['34'] = "turns";
$str_array['40'] = "great";