How do I get "explode" and "array_unique" merged

36 Views Asked by At

i have two tables, one separates tags by comma, the other converts similar tags to single tags.

example:

The exploded tags table I got in the database:

<?php  
  
 foreach ($result as $row) {
     
     $explode = explode(",",$row["turler"]);
    ?>
  
 <?php   foreach ($explode as $exp) {
  ?> 
  <?= $exp ;?> 
   
    <?php 
  } }?>

The table I want to adapt and put into an array:

         <?php
$vturler=array("tag1","tag2","tag2","tag3","tag1");
$tur = array_unique($vturler);

   foreach( $tur as $vturler ) { ?> 
        <?php echo "$vturler";?>
                               
  <?php  } ?> 

I want to combine these two. I want to enclose the "explode" values in the first table into the "array" in the bottom table.

0

There are 0 best solutions below