Jump to content

How can I put sentences into an array?


mcrae

Recommended Posts

Hello everyone, I'm really new to php, here is what I want to do.

 

Search through a body of text, untill it reaches "." "!" or "?" followed by single or double quotes, or a space. then put all text its gone through so far into the first array element. Then start over from that position.

 

I was trying to do it like this: $url = explode("[.|/?|!] ", $_REQUEST["text"]);

but it wasn't working, I can only get it to work for a single punctuation, and then the data in the arrays doesn't have punctuation, which is a bad thing. Can anyone help please?

 

The final purpose of the script is to display the shortest 5 and longest 5 sentences in the text, if that matters at all :)

Link to comment
https://forums.phpfreaks.com/topic/81791-how-can-i-put-sentences-into-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.