I have a paragraph below, that I want from it is the first word of every end of a period.
$paragraph="Microsoft is writing down $6.2 billion of the goodwill within its OSD. It's worth noting that at the time of the acquisition, the company recorded $5.3 billion of goodwill assigned to the OSD, bringing its total carrying balance up to $5.9 billion in September of that year. The goodwill in the OSD had climbed up to $6.4 billion by March of this year, so this accounting charge is wiping out the vast majority of that figure.";
for example, I can do this.
$sentences=explode('.',$paragraph);
print_r( $sentences);
and it prints
Array ( [0] => Microsoft is writing down $6
[1] => 2 billion of the goodwill within its OSD
[2] => It's worth noting that at the time of the acquisition, the company recorded $5
[3] => 3 billion of goodwill assigned to the OSD, bringing its total carrying balance up to $5
[4] => 9 billion in September of that year
[5] => The goodwill in the OSD had climbed up to $6
[6] => 4 billion by March of this year, so this accounting charge is wiping out the vast majority of that figure
[7] => )
however, I was wandering how can one get the first word from every array. for example how is it possible to create a function that will get the first word like the example below:
Microsft 2 it's 3 9 The 4
Thanks
explode(' ',$paragraph)homeworktag in the future so people can properly answer the question.