I am trying to get a full part from a string, means that I dont want some half words, HTML tags etc.
I tried 2 things, both didn't work.
Code: Select all
$row['desc'] = substr( strip_tags($row['s_desc']), 0, 55 ); // getting half of some wordsCode: Select all
preg_match_all("#\b\s\b#", $row['s_desc'], $matches);
print_r($matches);If you didn't understand, lets say this my string:Array ( [0] => Array ( [0] => ) ) Array ( [0] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => ) ) Array ( [0] => Array ( [0] => [1] => [2] => [3] => ) )
When I'm using my first method, It will print something like this:I am nobody.Nobody is perfect.Therefore, I AM PERFECT.Word word word word word word word word
When I'm using my second method, still an empty array..I am nobody.Nobody is perfect.Therefore, I AM PERFECT.Word word word word word word wo
Thanks in advance.