PHP を使用して、次の文字列「ランダムな単語 [Ab]another few words here [Bx]and yet a [Sq4]few more」を次の配列に分割するにはどうすればよいですか。
array[0] = 'Random words '
array[1] = '[Ab]'
array[2] = 'another few words here '
array[3] = '[Bx]'
array[4] = 'and yet a '
array[5] = '[Sq4]'
array[6] = 'few more'
文字列 [xxx] が区切り文字として機能し、中かっこの間に 1 ~ 4 文字の英数字を含めることができますか?
また、2 つの配列を作成する場合に、同様のことを行うにはどうすればよいでしょうか。
arrayA[0] = 'Random words '
arrayA[1] = 'another few words here '
arrayA[2] = 'and yet a '
arrayA[3] = 'few more'
arrayB[0] = '[Ab]'
arrayB[1] = '[Bx]'
arrayB[2] = '[Sq4]'
ここで何か助けていただければ幸いです。