openpolitics.com

  • writing
  • quotes
  • Topics
    • academia
    • corruption
    • economics
    • education
    • environment
    • finance
    • history
    • hypertext
    • media
    • philosophy
    • psychology
    • religion
    • russia
    • ted nelson
  • about
← Previous Next →

Programming: Trim to Full Word

this is great but do you know how I would end with a full word?

 

$the_str = substr($excerpt, 0, 20);
$the_str = trim(preg_replace( '/\s+/', ' ', $the_str));

 

source: $link[host]

Tags: programming

Read Original Source

Tim Langeman © 2025 · Genesis Framework · WordPress · Log in