Jump to content

kevin_newbie

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kevin_newbie's Achievements

Member

Member (2/5)

0

Reputation

  1. @ChemicalBliss - WOW thanks so much for all this. But the thing I am having in issue is how can I pick how many sentences I want and display it without saying "array"? Thank you once again and I really appreciate this.
  2. I found this expression that involves dr, mr, mrs and so forth. <([DM][rs]{1,2}). Just having a hard time incorporating it with my current expressions. :/
  3. Okay tried the ellipsis and it works perfect for that part. But with "mrs." it stops at that word with the period. So it is broken for that part.
  4. Why use the str_ireplace? Case sensitive?
  5. I don't want to remove those I just want the function to skip over those so that it is not considered an end to a sentence. Right now I am doing a function that replace the word to full words. function replaceWord($description) { $abrev = array("dr.","dr", "DR.", "DR", "Dr.", "Dr" ); $words = array("doctor", "doctor", "Doctor", "Doctor", "Doctor", "Doctor"); $change = str_replace($abrev, $words, $description); return $change; } It is alright for now but I want it more dynamic than listing out every possible ways. Thanks.
  6. Yeah the function is doing that but it breaks if there is something like "Mr." or "Dr." anything that is two letters with a "." in front of it.
  7. Hello, I have an update, I found a function where it grabs the first leading or however many sentence you want from a string. So it finds the sentence that either has a "! . or ?" which are considered leading sentences. Now is there a way to find a match where if there are any "something." with in this function we can just skip over that? function getLeadingSentences($data, $max) { $re = "[^s*[^.?!]+[.?!]+s*]"; $out = ""; for($i = 0; $i < $max; $i++) { if(preg_match($re, $data, $match)) { //if a sentence is found, take it out of $data and add it to $out $out .= $match[0]; $data = preg_replace($re, "", $data); } else { $i = $max; } } return $out; } Thanks
  8. @ Andy-H - I did your code and I got this error "Notice: Undefined offset: 1 . . . " :/ @sug15 - so did you ended up using the split function in php?
  9. Why does it remove the last letter of word before it puts a period? Also can I add in a "? and !" part?
  10. Hello, I am working on a project and I want to explode after the second period of the description but if the sentence has a "Dr." I don't want that to be counted as part of the array. This is what I have now: $content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc Dr. Tom id lectus ante. Suspendisse potenti. Fusce eu ante mattis eros hendrerit imperdiet. Fusce at ante mauris, vel dapibus quam. Duis vel vestibulum neque. Aenean viverra condimentum ante, ut vulputate diam volutpat non. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce nibh diam, sollicitudin at vulputate a, commodo nec ligula." $explode = explode('.', $content); echo $content[0] . '.' . $content[1] . '.' ; The code above displays on the browser as: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc Dr. I would like it to skip the "Dr." if possible. Is it? Thanks for your help
  11. Okay so using this function is echoing out one integer which is the day correct? DateDiff(startdate(now()), enddate(datetime from db))
  12. Hello, I have noticed that sites usually format dates of entries like: "Submitted 1 hour ago. or Submitted 1 day 2 hours ago. " What is the logic of doing something like this? Right now I have the date already inserted in the db along with the entries and just want to be able to format with days instead of the traditional Jan. 25th 2009 @ 4:25pm. Thanks, kevin_newbie.
  13. OH nice thanks Crayon, I did this just before the imagettftext $newcode = ''; $codearray = str_split($code); for($i = 0;$i < count($codearray);$i++) { $newcode .= $codearray[$i].' '; }
×
×
  • 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.