php - Limit lengths of items in array -


i want create summary of descriptions in array because acting link full post.

so example. "i went park today" become "i went th..."

i have tried following without success.

the array need alter $description[]

foreach ($description $descriptions) {    $descriptions = substr($descriptions, 0, 12);    $description = ($description + '...'); } 

try , use new variable $desc

$desc = array(); foreach ($description $descriptions) { $desc[] = substr($descriptions, 0, 12).'...';  } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -