kotharisandeep Posted May 17, 2007 Share Posted May 17, 2007 if an using PHP version 4.4.4 & using this code $first=strpos($tag,"<embed"); $second=strpos($tag,"</embed>"); $url=substr($tag,$first,$second-$first); $tmp1 = explode("src=", $url); $tmp2 = explode(" ", $tmp1[1]); $url1 = str_replace("\"", "", $tmp2[0]); $url2 = str_replace("'", "", $url1); $url2 = str_replace("\\", "", $url1); its giving proper result for such code <object width="425" height="350"><param name="movie" value=" name="wmode" value="transparent"></param><embed src=" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object> but not giving for this code <style>.hov:hover{background-color:yellow}</style><div id='Title' style='font:bold 13px verdana;width:310px'>Music Video:<a class='hov' style='display:block;width:310px;border:solid 2px black;padding:5px' href="http://videzonn.com/videos/t/the_shins/phantom_limb_whos_next.html" target='_blank'>PHANTOM LIMB: WHO’S NEXT? (by The Shins)<p><embed name='RAOCXplayer' src='http://videzonn.com/videos/t/the_shins/phantom_limb_whos_next_673538.asx' type='application/x-mplayer2' width='300' height='280' autostart='1' ShowControls='1' ShowStatusBar='0' loop='true' EnableContextMenu='0' DisplaySize='0' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/'></embed></a><p style="margin:3px 0px"><a href='http://videzonn.com/' class=ll target=_blank>Music Video Code provided by Video Code Zone</a></p></div> in second case it gives me 'http://videzonn.com/videos/t/the_shins/phantom_limb_whos_next_673538.asx' but i need http://videzonn.com/videos/t/the_shins/phantom_limb_whos_next_673538.asx & working fine with 5.1 but not with 4.4.4 Link to comment https://forums.phpfreaks.com/topic/51781-how-to-remove-in-string-if-it-encounter-in-string/ Share on other sites More sharing options...
radar Posted May 17, 2007 Share Posted May 17, 2007 $whatever = str_replace($whatever, "'", ""); be the easiest way -- it'll get rid of all of them. Link to comment https://forums.phpfreaks.com/topic/51781-how-to-remove-in-string-if-it-encounter-in-string/#findComment-255122 Share on other sites More sharing options...
chigley Posted May 17, 2007 Share Posted May 17, 2007 You got your syntax wrong radar: <?php $whatever = str_replace("'", "", $whatever); ?> Link to comment https://forums.phpfreaks.com/topic/51781-how-to-remove-in-string-if-it-encounter-in-string/#findComment-255272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.