Created
October 1, 2014 17:14
-
-
Save rodrigoea/72b73ae5393be74f7e3b to your computer and use it in GitHub Desktop.
Cut text after a number of characters and after the last point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$text = "Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nullam id dolor id nibh ultricies vehicula ut id elit. Donec id elit non mi porta gravida at eget metus."; | |
$split = strpos($text, '. ', 10)+1; | |
$text1 = wpautop(substr($text, 0, $split)); | |
$text2 = wpautop(substr($text, $split)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment