Delete Repeated Words from Variable

-3

Follow the code:

$selbanco = "SELECT * FROM exemplo WHERE id=5";
$querybanco = mysql_query($selbanco);


while($teste=mysql_fetch_array($querybanco)){

  $testando = $teste['teste'];
}

<td id="idcampo"> ><?php 
  if($teste1>$teste2){
      echo "$testando";
      } 
          else {
echo "(Agurde)" </td>


<script>var exemplo = $("#idcampo").html();</script>
$exemplo = "<script>document.write(exemplo)</script>";

echo $exemplo;

When displaying this example variable with echo does it return "example example", would it have any command or something it can use to return only "example" without repeating the word?

Note: The variable I get in the database is duplicated ("example example")

    
asked by anonymous 26.04.2016 / 20:56

1 answer

1

Would you have any 'command' or something you can use to return only 'example' without repeating the word?

The answer to is question is yes, but for the general question there is no way to answer because that question was not very well 'engineered'.

implode(' ',array_unique(explode(' ', 'exemplo exemplo')));
    
26.04.2016 / 22:20