Array and Glob Doubts

0

I want to get 2 foreach entries and delete one based on another, for example.

In a foreach I have the value "stackoverflow" and in the other I also have the same, and then one overrides the other and then the 2 do not appear in echo. What am I doing?

$filee2 = array();
glob("C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/*/*.mp4") as $filee) {
    $filee2 = array($filee => $filee);
}

foreach (glob("C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/*.ts") as $filename) { 

$file1 = str_replace('.mp4','',$filee2);
$file2 = explode("/", $file1);
    
    print_r($filee2).'<br>';
    
$file3 = str_replace('.ts','',$filename);
$file4 = explode("/", $file3);
    if( $file4[7] == $file2[8] ){

    }else{

?>

    <li><form method="post" enctype="multipart/form-data">
        
        <?=str_replace('C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/', '', $filename)." - Tamanho: " . formatSizeUnits(filesize($filename))?>
        <input type="hidden" name="converternome" value="<?=str_replace('C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/', '', $filename)?>">
        <input type="submit" name="converter" value="converter">
               
    </form><br /></li>
        
<?php
        }//Fim do if
}//Fim do foreach filename
?>
    
asked by anonymous 02.09.2017 / 20:52

1 answer

0

I was able

<?php
$convertidos = array();
foreach (glob("C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/*/*.mp4") as $filee) {
    
    $file1 = str_replace('.mp4','',$filee); 
    $file2 = explode("/", $file1);  
    
    $convertidos[] = $file2[8];

}

foreach (glob("C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/*.ts") as $filename) { 
    
$file3 = str_replace('.ts','',$filename);
$file4 = explode("/", $file3);
    
    if(in_array($file4[7], $convertidos)){
    }else{

?>

    <li><form method="post" enctype="multipart/form-data">
        
        <?=str_replace('C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/', '', $filename)." - Tamanho: " . formatSizeUnits(filesize($filename))?>
        <input type="hidden" name="converternome" value="<?=str_replace('C:/Users/raphael/Downloads/Videos/Lives Baixadas/Converter/', '', $filename)?>">
        <input type="submit" name="converter" value="converter">
               
    </form><br /></li>
        
<?php
        }//Fim do if
}//Fim do foreach filename
?>

I used In_array and I was able to do what I needed.

    
02.09.2017 / 21:58