title: How to get a single value from an associative array PHP
body: <p>When I code =>    </p>
  
  <pre><code>if((isset($filename1))){
      print_r(array_values($filename1));
      $file_name=$filename1['file_name'];
      echo $file_name." this is file_name&lt;br&gt;";
      echo $filename1['file_name']."This isdirectly from the array &lt;br&gt;";
      }
  </code></pre>
  
  <p>I get the following out put and error=></p>
  
  <pre><code>Array ( [0] =&gt; Array ( [file_name] =&gt; uygun10.pgn [file_type] =&gt; application/x-chess-pgn [file_path] =&gt; D:/wamp/www/proje/uploads/ [full_path] =&gt; D:/wamp/www/proje/uploads/uygun10.pgn [raw_name] =&gt; uygun10 [orig_name] =&gt; uygun.pgn [client_name] =&gt; uygun.pgn [file_ext] =&gt; .pgn [file_size] =&gt; 0.48 [is_image] =&gt; [image_width] =&gt; [image_height] =&gt; [image_type] =&gt; [image_size_str] =&gt; ) )
  A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined index: file_name
  
  Filename: controllers/Hesaplama.php
  
  Line Number: 58
  
  Backtrace:
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 58
  Function: _error_handler
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 263
  Function: pgn_oku
  
  File: D:\wamp\www\proje\application\controllers\Welcome.php
  Line: 28
  Function: pozisyon_tutma
  
  File: D:\wamp\www\proje\index.php
  Line: 292
  Function: require_once
  this is file_name
  A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined index: file_name
  
  Filename: controllers/Hesaplama.php
  
  Line Number: 60
  
  Backtrace:
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 60
  Function: _error_handler
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 263
  Function: pgn_oku
  
  File: D:\wamp\www\proje\application\controllers\Welcome.php
  Line: 28
  Function: pozisyon_tutma
  
  File: D:\wamp\www\proje\index.php
  Line: 292
  Function: require_once
  </code></pre>
  
  <p>When I modify the code as follows =></p>
  
  <pre><code>if((isset($filename1))){
  print_r(array_values($filename1));
  $file_name=$filename1[0]['file_name'];
  echo $file_name." this is file_name&lt;br&gt;";
  echo $filename1[0]['file_name']."this is directly from the array &lt;br&gt;";
  }
  </code></pre>
  
  <p>I get the following output and error =></p>
  
  <pre><code>Array ( [0] =&gt; Array ( [file_name] =&gt; uygun11.pgn [file_type] =&gt; application/x-chess-pgn [file_path] =&gt; D:/wamp/www/proje/uploads/ [full_path] =&gt; D:/wamp/www/proje/uploads/uygun11.pgn [raw_name] =&gt; uygun11 [orig_name] =&gt; uygun.pgn [client_name] =&gt; uygun.pgn [file_ext] =&gt; .pgn [file_size] =&gt; 0.48 [is_image] =&gt; [image_width] =&gt; [image_height] =&gt; [image_type] =&gt; [image_size_str] =&gt; ) )
  A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined offset: 0
  
  Filename: controllers/Hesaplama.php
  
  Line Number: 58
  
  Backtrace:
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 58
  Function: _error_handler
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 263
  Function: pgn_oku
  
  File: D:\wamp\www\proje\application\controllers\Welcome.php
  Line: 28
  Function: pozisyon_tutma
  
  File: D:\wamp\www\proje\index.php
  Line: 292
  Function: require_once
  this is file_name
  A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined offset: 0
  
  Filename: controllers/Hesaplama.php
  
  Line Number: 60
  
  Backtrace:
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 60
  Function: _error_handler
  
  File: D:\wamp\www\proje\application\controllers\Hesaplama.php
  Line: 263
  Function: pgn_oku
  
  File: D:\wamp\www\proje\application\controllers\Welcome.php
  Line: 28
  Function: pozisyon_tutma
  
  File: D:\wamp\www\proje\index.php
  Line: 292
  Function: require_once
  </code></pre>
  
  <p>How can I possibly reach single items which are apparently in array $filename1...?
  Thank you all</p>