PHP:从多数组获取值

I am trying to retrieve a value from an Array. Here is the code:

I have array like:

$video_categories = get_the_terms( get_the_ID(), 'videos_cat', ', ' );

when print it the result:

Array
    (
        [22] => stdClass Object
            (
                [term_id] => 22
                [name] => فيديو
                [slug] => videos
                [term_group] => 0
                [term_taxonomy_id] => 47
                [taxonomy] => videos_cat
                [description] => 
                [parent] => 0
                [count] => 383
                [object_id] => 26138
                [filter] => raw
            ),
        [23] => stdClass Object
            (
                [term_id] => 23
                [name] => العاب
                [slug] => videos
                [term_group] => 0
                [term_taxonomy_id] => 47
                [taxonomy] => videos_cat
                [description] => 
                [parent] => 0
                [count] => 383
                [object_id] => 26138
                [filter] => raw
            )

    )

How can I get the value of term_id in variable to print it?

Access the index of the array as normal array[index]. This contains an object, so you need to use object operator to access it's properties and methods like object->property or object->method().

From what it seems your are doing, it'd be something like:

echo $categories[22]->term_id;