Welcome Guest, Not a member yet? Register   Sign In
accessing an element in an array of arrays
#1

(This post was last modified: 04-03-2021, 06:40 AM by richb201.)

PHP Code:
$files_to_upload = Array
(
        [sd1e6fec1] => Array
        (
                [name] => 86.jpg
                
[type] => image/jpeg
                
[tmp_name] => C:\wamp\tmp\phpFC42.tmp
                
[error] => 0
                
[size]  => 258177
        
)






I am trying to access the size element using this:
$size=$files_to_upload[$name].size;

when I run this I get $size="Arraysize". I am just trying ti get the size element.  How can get that 258177 number?

$name is a string that I got from another structure.
proof that an old dog can learn new tricks
Reply
#2

For what you want it should be something like this not tested. It depends on if you know the keys value.

PHP Code:
$size $files_to_upload['sd1e6fec1']['size']; 

try that
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

works! thx
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB