How to check condition and print a value using views-view-field--viewname.tpl.php?
I'm also unable to check the condition for the fields:

&lt;?php if($fields['field_some_field_name']-&gt;content == 'Test') { } ?&gt;



That is probably because in actuality:

$fields['field_some_field_name']-&gt;content = &lt;div&gt;Test&lt;/div&gt;

Therefore, &lt;div&gt;Test&lt;/div&gt; is not equal to Test

So what you could do is use raw instead, as raw has no html/markup around the value.

&lt;?php if($fields['field_some_field_name']-&gt;raw == 'Test') { } ?&gt;


else, you could still use content with the PHP striptags() function

&lt;?php if(striptags($fields['field_some_field_name']-&gt;content) == 'Test') { } ?&gt;


Or else, you could still use your original &lt;?php print $fields['field_some_field_name']-&gt;content; ?&gt; but as long as you strip all the markup added by views as shown in my answer to "Is there a more performant alternative than overriding template files?".