L.S.
I am trying to cut a string into substrings. The string at hand looks
something like this:
$data='one|two| three|four\nfiv e|six|seven|eig ht'; //observe the chr(10) in
the middle
I would like to have this split two times. Once to give me the two
'sentences' 'one|two|three| four' and 'five|six|seven |eight'. Then, each of
these sentences would be split into their repective words. Initially I
thought it would be simple:
$sentence=preg_ split("\n",$dat a); //should give me an array $sentence
$word=preg_spli t("|",$senten ce[0]); //should give me an array $word
Unfortunately this doesn't work and now I am caught up in a new world of
'regular expression functions' that doesn't seem to make any sense. Can you
please help me to get this split function to do what I need?
Thanks for your reply, Peter.
I am trying to cut a string into substrings. The string at hand looks
something like this:
$data='one|two| three|four\nfiv e|six|seven|eig ht'; //observe the chr(10) in
the middle
I would like to have this split two times. Once to give me the two
'sentences' 'one|two|three| four' and 'five|six|seven |eight'. Then, each of
these sentences would be split into their repective words. Initially I
thought it would be simple:
$sentence=preg_ split("\n",$dat a); //should give me an array $sentence
$word=preg_spli t("|",$senten ce[0]); //should give me an array $word
Unfortunately this doesn't work and now I am caught up in a new world of
'regular expression functions' that doesn't seem to make any sense. Can you
please help me to get this split function to do what I need?
Thanks for your reply, Peter.
Comment