To replace words in a string in php -
To replace words in a string in php -
i have query result written bellow
(383,'_transient_dash_aa95765b5cc111c56d5993d476b1c2f0','<div class="rss-widget"><ul><li><a class='rsswidget' href='http://ma.tt/2013/02/new-yahoo-2/' title='marissa mayer announces new yahoo hompage, on wordpress-powered blog. […]'>matt: new yahoo</a></li><li><a class='rsswidget' href='http://ma.tt/2013/02/100-gpl/' title='creative market announced of wordpress themes 100% gpl, meaning list in marketplace , reach users theme must provide users same freedoms wordpress does. have great themes already. fantastic news , i’m proud of team taking bold step, , promised […]'>matt: 100% gpl</a></li><li><a class='rsswidget' href='http://wordpress.tv/2013/02/20/leslie-hancock-developing-a-distinctive-online-voice/' title=' […]'>wordpress.tv: leslie hancock: developing distinctive online voice</a></li><li><a class='rsswidget' href='http://wordpress.tv/2013/02/20/scott-basgaard-help-yourself-by-helping-others/' title=' […]'>wordpress.tv: scott basgaard: help helping others</a></li><li><a class='rsswidget' href='http://feedproxy.google.com/~r/weblogtoolscollection/uxmp/~3/3tj7mipbhoc/' title='the new default theme wordpress 3.6, titled 20 thirteen, making progress. year’s default theme overseen matt mullenweg, , built joen asmussen, konstantin obenland, , lance willett. goal 20 13 offer “a focus on blogging, , great back upwards post formats (which getting attending on backend in 3.6 […]'>weblog tools collection: 20 13 theme in progress</a></li></ul></div>','no'),(384,'_transient_timeout_feed_57bc725ad6568758915363af670fd8bc','1361468732','no')
now in above string got
class='rsswidget' , href='http://ma.tt/2013/02/new-yahoo-2/' , title='marissa mayer announces new yahoo hompage, on wordpress-powered blog. […]'
i want replace string
class='rsswidget' class="rsswidget" href='http://ma.tt/2013/02/new-yahoo-2/' href="http://ma.tt/2013/02/new-yahoo-2/" title='marissa mayer announces new yahoo hompage, on wordpress-powered blog. […]' title="marissa mayer announces new yahoo hompage, on wordpress-powered blog. […]"
i tried bellow written code.
if(strstr($sql, "href='")){ $sql = str_replace("href='*'", 'href="*"', $sql); $data = $sql; fwrite($handle, $data); }
is there wrong code or other way alter words in string. please help me.
php
Comments
Post a Comment