Using views to display content comparing users id First of all, sorry for my bad english.

I'm using Drupal 7

Here is my problem : 

I have a views in wich I would like to display a list of custom content type only for the users that I selected with a custom field "entity ID" in this custom content type. 
This users share the same role, but they can't see the node of others users (of the same role or another role as well).

I taught the simplest method would be to add some PHP code thanks to the PHP views module, but if you have a better solution I'll love to hear that.

So this is what I made so far:

I added a global PHP in the filters criteria section of the view with this code:

global $user;
$current_user = $user-&gt;uid;
$destiny_user = $data-&gt;field_field_uttilisateur[0][raw][entity]-&gt;uid;

if ($current_user == $destiny_user) {
   return false;
} else {
   return true;
}


Basicaly I'm comparing the current user ID with the ID I filled in the content type.
If this "function" returns true, then the current row is not displayed.

I don't have to worry to know if the user is authentified because I already do that in Page settings (Access)

But it seems like $destiny_user is always empty. I don't get it because when I add an global php field in the fields section all seems ok (I can see the ID of the user I whant to display the row)

I'm using this method $data->field_field_uttilisateur[0][raw][entity]->uid; because the $rows->field_uttilisateur; is not working. (It display the nid Oo)
After some research I found this solution that seems to work... at least more than the other one.

I'm having a really bad time with this, do you have some ideas how I can get this to work?

Thank you in advance !
This can be achieved using contextual filters in views. Here are the steps:


In the views edit page click on Advanced section.
Click on the Add button corresponding to "Contextual Filters"
Search for your custom field in your custom content type and add it.
In the configure contextual filter which appears make the following changes.
Under "When the filter value is not in the url" section, select the option "Provide default value". In the type select list, select the option "User ID from logged in user".

Save the changes.