Getting specific property from node_load I have an article that I've set to a variable like this:

$this_node = node_load($nid);


I've done a print_r on $this_node and this is what I get - it's pretty long, sorry:

stdClass Object
(
    [nid] =&gt; 67572
    [type] =&gt; imagevault
    [language] =&gt; 
    [uid] =&gt; 3
    [status] =&gt; 1
    [created] =&gt; 1303347600
    [changed] =&gt; 1305662899
    [comment] =&gt; 0
    [promote] =&gt; 0
    [moderate] =&gt; 0
    [sticky] =&gt; 1
    [tnid] =&gt; 0
    [translate] =&gt; 0
    [vid] =&gt; 67572
    [revision_uid] =&gt; 1
    [title] =&gt; Anne Jones
    [body] =&gt; 
    [teaser] =&gt; 
    [log] =&gt; 
    [revision_timestamp] =&gt; 1305662899
    [format] =&gt; 2
    [name] =&gt; pbreen
    [picture] =&gt; 
    [data] =&gt; a:0:{}
    [field_pub_date] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [value] =&gt; 
                    [timezone] =&gt; America/Chicago
                    [timezone_db] =&gt; America/Chicago
                    [date_type] =&gt; date
                )

        )

    [field_att_file] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [fid] =&gt; 59327
                    [uid] =&gt; 3
                    [filename] =&gt; KCJones.jpg
                    [filepath] =&gt; sites/default/files/images/KCJones.jpg
                    [filemime] =&gt; image/jpeg
                    [filesize] =&gt; 54806
                    [status] =&gt; 1
                    [timestamp] =&gt; 1304023490
                    [list] =&gt; 1
                    [data] =&gt; Array
                        (
                            [description] =&gt; 
                        )

                )

        )

    [path] =&gt; imagevault/67572


    [0] =&gt; 
    [taxonomy] =&gt; Array
        (
            [264] =&gt; stdClass Object
                (
                    [tid] =&gt; 264
                    [vid] =&gt; 15
                    [name] =&gt; Kimberly-Clark
                    [description] =&gt; 
                    [weight] =&gt; 0
                )

            [137] =&gt; stdClass Object
                (
                    [tid] =&gt; 137
                    [vid] =&gt; 10
                    [name] =&gt; People
                    [description] =&gt; 
                    [weight] =&gt; 0
                )

        )

)


I know I can get certain values from the node like this:

$imagefile = array();
$imagefile['name'] = $this_node-&gt;field_att_file[0]['filename'];


Here's what I need to do, though (and I'm very new to Drupal so forgive me if this is really simple.) The article can, as shown, have multiple taxonomy terms. I need to treat a chunk of display code differently if the article has 137 as one of the taxonomy terms. How would I go about this?

Something like this, or is there a better way? (Don't even know if this way works yet; it probably won't since each tax term is an object, not an array.)

$this_tax = $this_node-&gt;taxonomy;
if (array_key_exists('137', $this_tax)) {
   // Do stuff
}
Something like that should actually work.

The only issue might be that you are looking for the string '127' but want the integer 127, so remove the '. But I'm not 100% sure right now how PHP handles that.

Also note that you can use isset() instead of array_key_exists() here, so just 

if (isset($this_node-&gt;taxonomy[137])) {
}


should work too. The difference between isset and array_key_exists() is that isset() returns FALSE if they key exists but the value of it is NULL, while array_key_exists() returns TRUE in that case.