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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -