Say I have the following line
$str = "once in a great while a good-idea turns great";
What would be the best solution to create an array with the array key being the string where the word (s) begins?
$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";
Blake source
share