editor.php

index.html
html = $htmlfiles;


    $dna->data = [];
    foreach($datafiles as $value){
        if($value[0] != "."){

            if(substr($value,-4) == ".txt"){
                array_push($dna->data,$value);
            }
            
        }
    }

    $dna->php = [];
    foreach($phpfiles as $value){
        if($value[0] != "."){
            array_push($dna->php,$value);
        }
    }



    echo json_encode($dna,JSON_PRETTY_PRINT);

    $file = fopen("data/dna.txt","w");// create new file with this name
    fwrite($file,json_encode($dna,JSON_PRETTY_PRINT)); //write data to file
    fclose($file);  //close file

?>