Search code examples
phparraysvariablespsql

Selector array php to sting


This is output from print_r ($filename);

How can i select the [filename] so i can out put the two [filename] variables as one string?

Array
(
    [0] => Array
        (
            [filename] => 001-68316-000-9000-000.jpg
        )

    [1] => Array
        (
            [filename] => 001-68316-002-9000-001.jpg
        )

)

Solution

  • foreach ($filename as $item) {
     $file_name .= $item['filename']." ";
    }
    
    echo $file_name;