File exists php code
<pre><code>&lt;?php

function data_info($data)
{
    if ($data) {
        while (!feof($data)) {
            $buffer = fgets($data);
            if (file_exists($buffer)) {
            $bufferArray[$buffer]['Exists'] = (file_exists($buffer));
            $bufferArray[$buffer]['Readable'] = (is_readable($buffer));
            $bufferArray[$buffer]['Writable'] = (is_writable($buffer));
            $bufferArray[$buffer]['Size'] = (filesize($buffer));
            } else {
                $bufferArray[$buffer]['Exists'] = "No";
            }
        }
        print_r($bufferArray);
    } else {
        echo "The file could not be opened";
    }
}

$data = fopen("D:/xampp/htdocs/Practice/ficheros.txt", "r");
data_info($data);

?&gt;
</code></pre>

<p>If I have this:
ficheros.txt:
ExistingFile.txt
ExistingFile2.txt
ExistingFile3.txt...
...
It works, but If I have at least 1 NON EXISTING FILE then It will take every file as a non existing one too.</p>

<p>What's wrong? I believe someting in the inner if condition.</p>

<hr>

<p>I mean, what is wrong with the entire code.</p>

<p>I just need to make an array with arrays in it, a good result would be:</p>

<pre><code>    array
(
    'text.txt' =&gt; array
        (
        'exists' =&gt; true,
        'readable' =&gt; true,
        'writable' =&gt; true,
        'Size' =&gt; 64
        ),

    'document.doc' =&gt; array
        (
        'exists' =&gt; false
        ),

    'photo.jpg' =&gt; array
        (
    'exists' =&gt; true,
    'readable' =&gt; true,
    'writable' =&gt; false,
    'size' =&gt; 354915
        )
)
</code></pre>
