PHP code in contextual filter (Views) I would like to get a value from the reference node of the node_id
I used this code for PHP code in Contextual filter... 

$node = menu_get_object();
if ($node-&gt;type == 'trailer_videos'){    
       $mynode = node_load($node-&gt;nid)-&gt;field_trailer_video_of[und][0][target_id];
return $mynode;
}


The result is CORRECT!! but the page itself throw 2 errors:


Notice: Use of undefined constant und - assumed 'und' in eval() 
Notice: Use of undefined constant target_id - assumed 'target_id' in eval() 


Whats wrong with my code above????
Why don't you use entity metadata wrapper?  your code will be:

$node = menu_get_object();
    if ($node-&gt;type == 'trailer_videos'){
           $wrapper = entity_matadata_wrapper('node',$node);
           $mynode = $wrapper-&gt;field_trailer_video_of-&gt;value();
           return $my_node;
     }


If you don't want to use entity module, use kpr of devel module to get the right syntax, as Ollie said quotes are needed.