Display a flag link in views based on whether the node has an associated taxonomy term
You could achieve this easily using views without using views php field. More specifically you can create a view of content with an EVA (entity views attach) field display where you will add the flag link field and attach it to the nodes of that content type. Just make sure to:


Add a contextual filter of Content:Nid
Add a relationship of "Content:Taxonomy terms on node"
Also add a "Flags: Node flag" relationship (uncheck the include flagged content only checkbox)
Add a filter "Content type:...your content type which nodes will have the flag link 
Add a filter "Taxonomy term: Term ID" that will equal to the tid of the "fruit" term.


After that you can easily choose how to display this eva field on your nodes using Display suite.