-6
Array
(
    [users] => Array
        (
            [0] => Array
                (
                    [id] => 707865603789484032
                    [id_str] => 707865603789484032
                    [name] => Mintgroupation
                    [screen_name] => mintgroupation
                    [location] => 
                    [url] => 
                    [description] => 
                    [protected] => 
                    [followers_count] => 0
                    [friends_count] => 45
                    [listed_count] => 0
                    [created_at] => Thu Mar 10 09:48:06 +0000 2016
                    [favourites_count] => 0
                    [utc_offset] => 
                    [time_zone] => 
                    [geo_enabled] => 
                    [verified] => 
                    [statuses_count] => 0
                    [lang] => en
                    [contributors_enabled] => 
                    [is_translator] => 
                    [is_translation_enabled] => 
                    [profile_background_color] => F5F8FA
                    [profile_background_image_url] => 
                    [profile_background_image_url_https] => 
                    [profile_background_tile] => 
                    [profile_image_url] => http://abs.twimg.com/sticky/default_profile_images/default_profile_4_normal.png
                    [profile_image_url_https] => https://abs.twimg.com/sticky/default_profile_images/default_profile_4_normal.png
                    [profile_link_color] => 2B7BB9
                    [profile_sidebar_border_color] => C0DEED
                    [profile_sidebar_fill_color] => DDEEF6
                    [profile_text_color] => 333333
                    [profile_use_background_image] => 1
                    [has_extended_profile] => 
                    [default_profile] => 1
                    [default_profile_image] => 1
                    [following] => 
                    [follow_request_sent] => 
                    [notifications] => 
                    [muting] => 
                    [blocking] => 
                    [blocked_by] => 
                )

            [1] => Array
                (
                    [id] => 707865725382369280
                    [id_str] => 707865725382369280
                    [name] => Mahmod Hassan

and so on......

I want to get the name ([name]) in variable

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Try `$name = $arrayName[1]['name];` and echo `$name;` – Sanjay Chaudhari Mar 10 '16 at 09:59
  • Have you read the documentation of PHP [arrays](https://secure.php.net/manual/en/language.types.array.php#language.types.array.syntax.accessing)? It is full of examples. – axiac Mar 10 '16 at 09:59
  • May I suggest you format your question so that it is readable. Looks like you need a `foreach($array['users'] AS $user) { echo $user['name']; }`. – Egg Mar 10 '16 at 10:05

1 Answers1

1

Suppose you have users data in $users variable.

$names = array_map(function($user){
              return $user['name'];
        }, $users);

Now you've all users name in $names variable

print_r($names);
Ravindra Bhalothia
  • 1,720
  • 2
  • 13
  • 16