Picking values from a multi-dimensional array using PHP & Laravel-ThrowExceptions

Exception or error:

So I have a multi-dimensional array, an example below. I want to pick out specific values from this in my view (I am using Laravel).

The data has been passed to my view. I want all the names of users which I have done using:

@foreach ($users as $key => $value)
    {{ $key }}
@endfoeach

That is fine, it returns testuser, testuser1, and testuser2.

But in addition, I want to return just the domain and email from the inner array. I can get all items no issues by creating a new loop but can’t figure out how to get just specific items.

I appreciate any help.

Array
(
[testuser] => Array
    (
        [bandwidth] => 36.4/128000
        [domain] => test.com
        [email] => test@user.com
        [inodes] => 1566
    )

[testuser1] => Array
    (
        [bandwidth] => 36.41/128000
        [domain] => test.com
        [email] => test@user.com
        [inodes] => 1566
    )

[testuser2] => Array
    (
        [bandwidth] => 36.42/128000
        [domain] => test.com
        [email] => test@user.com
        [inodes] => 1566
    )

)

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *