bonjour
y a t-ils quelle qu'un pour m'aider a terminer mon script qui sera utilisée pour faire du déboulonnage de fichier selon le contenu de la premier ligne de chaque fichier.
voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
 
$a      = 1;
$b      = 1;
$ligne1 = array();
$ligne2 = array();
$jh = 1;
while (file_exists("lesform/form" . $jh . ".txt")) {
    $jh++;
}
$jh--;
 
while ($a < $jh) {
    $body1    = fopen("lesform/form" . $a . ".txt", "r");
    $ligne1[] = fgets($body1, 5000);
    $a++;
}
 
while ($b < $jh) {
    $body2    = fopen("lesform/form" . $b . ".txt", "r");
    $ligne2[] = fgets($body2, 5000);
    $b++;
}
$c        = 0;
$d        = 1;
$e        = 1;
$nbra     = count($ligne1);
$nbrb     = count($ligne2);
while ($c < $nbra) {
    $d = 1;
    while ($d < $nbra) {
        if (!preg_match_all("#" . $ligne1[$d] . "#", $ligne2[$c], $resultat))
        {
            $e++;
            //if ($ligne1[$c] != $ligne2[$d]){
            echo "OK";
            $file     = file_get_contents("lesform/form" . $d . ".txt");
            $fichierR = fopen("fichierdeboulonner/form" . $d . ".txt", "w+");
            fwrite($fichierR, $file);
            fclose($fichierR);
            $file     = "";
        }
        $d++;
    }
    $c++;
}
?>
merci !