3v4l.org

run code in 300+ PHP versions simultaneously
<?php function TextSimilar($frase1,$frase2){ /* incio da função *************** */ $explosao = explode(' ', $frase1); $palavras = count($explosao);//contar o numero de palavras $i = 0; $wtemp =''; $novos = null;//array para receber os novos valores for($i=0;$i<$palavras;$i++){ $wtemp = $explosao[$i] ; $temvirgula=false; $temp =$wtemp; if(strpos($temp,',')>0){//verificiar existencia de virgula $temvirgula=true; $temp = substr($wtemp,0,strlen($wtemp)-1);} /* comparar a palavra com o modelo */ similar_text(strtoupper($temp),strtoupper($frase2),$percento); //se existir similitude if($percento>=95){ $temp = '<span style="color:#ff0000;font-weight:bold;">' . $temp .'</span>';} //repor a palavra $wtemp=$temp; if($temvirgula==true){ $wtemp = $temp . ',';} $novos[] = $wtemp; } //fim do for $x = implode(' ',$novos);// repor a frase return $x; /* fim da função ************ */ } $frase1 = 'N ga be mu vêdê, madji n saí me ka pia bô - como'; $frase2 = 'vêdê'; $x = TextSimilar($frase1,$frase2); echo $x;
Output for git.master, git.master_jit, rfc.property-hooks
N ga be mu <span style="color:#ff0000;font-weight:bold;">vêdê</span>, madji n saí me ka pia bô - como

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
65.64 ms | 401 KiB | 8 Q