People sometimes quote Proverbs 23:7 to say that the real person is the person inside, the way a person thinks. This is a real principle—Jesus said that by their fruits you will know them (Matthew 7:16-20) and that a person’s behavior issues from the heart (Matthew 15:17-20). Getting it from this verse in Proverbs is more problematic.
The first issue is how to translate this line. The New American Standard Bible quotes the line similarly to the King James Version here: “as he thinks within himself, so he is.” The New International Version, however, renders it: “for he is the kind of person who is always thinking about the cost” (which fits the context); the New Revised Standard Version even translates it, “for like hair in the throat, so are they.” If I were following the Greek translation, I would agree with the NRSV here, but the traditional Hebrew text seems more easily translated like we have it in the NASB or the KJV.
The second issue is the point in the context. The context is a selfish man urging you to eat the food he sets before you, but his heart is not really with you. If you eat too much of the food he shares, you will be sorry, because he really does not want to share much with you. His real attitude is what’s in his heart.
In the ancient world, sharing food obligated people to loyalty to one another. But Proverbs warns that you cannot trust your host if he is selfish; he may encourage you to eat as much as you like, but you will be sorry if you trust him. What matters is not what he says to you, but what he really thinks in his heart (Proverbs 23:6-8). In the same way, when you dine before a ruler and are tempted to eat the lavish meal prepared before you, put a knife to your throat (figuratively speaking) to keep yourself from eating too much (Proverbs 23:2).
You have to know the character of your host. When my wife cooks something, she really wants to share it as much as possible. I try to use resources more sparingly, to spread them around, so I eat and share food more sparingly. But when you don’t know someone well enough to trust their intentions, it may be wise to see how generous they really wish to be before imposing on them.
The point is not a general illustration about thinking in the heart (although it might illustrate that) but about keeping yourself and your appetite under control when your host may be more concerned about the cost of the food than about entertaining you. My Western culture has less sense of obligation to invite people for meals, but we still need to be sensitive to whether someone really wants to help us in given ways or we will be seen as a drain on their time and resources. In other words, choose your friends and allies wisely, and do not let your hair down (for those who still have hair!) in front of just anyone. Not everyone has the same intention.