arrays - how to change the value of a specific key in short words in php -
array of title replaced words temporary
    array (             [title] => led flash macro ring light (48 x led) 6 adapter rings for canon/sony/nikon/sigma lenses             [manufacturer] => neewer electronics accessories             [currency] => cad             [price] => 35.99       ) convert title values have less words temporary compare key
 array (         [title] => led flash macro ring         [manufacturer] => neewer electronics accessories         [currency] => cad         [price] => 35.99    ) 
not entirely sure if suffice try following.
$title=$arr['title']; $length=30; $smalltitle=rtrim( preg_replace('/\s+?(\s+)?$/', '', substr( $title, 0, $length ) ) ); echo $smalltitle;  $arr['title']=$smalltitle; 
Comments
Post a Comment