migacz
15.04.2003, 14:14:07
Mam następujący problem. Pobieram z bazy dwa pola text. Czy jest w php możliwość porównania textu i wyświetlenie ewentualnych różnic?
Jabol
15.04.2003, 15:03:03
[php:1:7d3e411e57]<?php
function wartosc($w){
return (empty($w)?'nd':$w);
}
$text1="Jakiś text";
$text2="Inny text";
$c=count($text1)>count($text2)?strlen($text1):strlen($text2);
for($i=0; $i<$c; $i++){
$t1=$text1{$i};
$t2=$text2{$i};
if($t1==$t2){
print '_';
}
else{
print '('.wartosc($t1).' : '.wartosc($t2).')';
}
}
?>[/php:1:7d3e411e57]
ten kod da
(J : I)(a : n)(k : n)(i : y)(� : )_____(nd : )(nd : g)(nd : f)(nd : a)(nd : g)