fer0an Posted July 21, 2010 Share Posted July 21, 2010 hello I've two text that I used $text1 and $text2. I want compare two text and echo difference. can anyone help me? Link to comment https://forums.phpfreaks.com/topic/208404-compare-two-text-and-echo-diffrence/ Share on other sites More sharing options...
jd307 Posted July 21, 2010 Share Posted July 21, 2010 Could you give a sample of what the input of these text values may be? Is it you have something like: $text1 = "abcdefg"; $text2 = "abcd"; Therefore your output would be "efg" ? Link to comment https://forums.phpfreaks.com/topic/208404-compare-two-text-and-echo-diffrence/#findComment-1089045 Share on other sites More sharing options...
fer0an Posted July 21, 2010 Author Share Posted July 21, 2010 $text1 = <div class="center"><b>X-Men Forever 2 #3</b><br/> English | 1280 x 2000 | CBR | 24.5 MB</div><br/> <br/> MU<br/> <a href="http://www.megaupload.com/?d=DCK1Q2KN" target="_blank" rel="nofollow">Download</a><br/> <br/> <b><div class="center"><a href="http://avaxhome.ws/blogs/olyr82" target="_blank" rel="nofollow">>>Visit my blog<<</a><br/> <br/> or<br/> <br/> <a href="http://www.website.ws/olyr82/rss.xml" target="_blank" rel="nofollow">>>Subscribe to my blog here<<</a><br/> <br/> for many more tv shows.</div></b> <br/> <br/> <b>No mirrors.</b> </div> <table class='file-express' width='100%'> <tr> <td style='text-align: left; color: #B2AC94; font-size: 3'>File exists.dllinktitletm= <font color='red' >X-Men Forever 2 #3 : found</font><br><font color='red' ><b>no2</b></font>X-Men Forever 2 #3 8043text added $text2 = <div class="center"><b>X-Men Forever 2 #3</b><br/> English | 1280 x 2000 | CBR | 24.5 MB</div><br/> <br/> MU<br/> <a href="http://www.megaupload.com/?d=DCK1Q2KN" target="_blank" rel="nofollow">Download</a><br/> <br/> Link to comment https://forums.phpfreaks.com/topic/208404-compare-two-text-and-echo-diffrence/#findComment-1089052 Share on other sites More sharing options...
jd307 Posted July 21, 2010 Share Posted July 21, 2010 Right... if I understand correctly, you want something like: $text1 = 'This is my wonderful piece of text'; $text2 = 'This is my wonderful'; $output = str_replace($text2, "", $text1); echo $output; $output will therefore equal " piece of text", thus removing text 2 from text 1... so $output would be the "difference" I suppose. Is this what you are trying to do? Link to comment https://forums.phpfreaks.com/topic/208404-compare-two-text-and-echo-diffrence/#findComment-1089066 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.