What does Matthew 6:5 mean?

Matthew 6:5 KJV
And when thou prayest, thou shalt not be as the hypocrites [are]: for they love to pray standing in the synagogues and in the corners of the streets, that they may be seen of men. Verily I say unto you, They have their reward.

Matthew 6:5 MKJV
And when you pray, you shall not be like the hypocrites. For they love to pray standing in the synagogues and in the corners of the streets, so that they may be seen by men. Truly I say to you, They have their reward.

Matthew 6:5 NKJV
“And when you pray, you shall not be like the hypocrites. For they love to pray standing in the synagogues and on the corners of the streets, that they may be seen by men. Assuredly, I say to you, they have their reward.

Matthew 6:5 KJV 2000
And when you pray, you shall not be as the hypocrites are: for they love to pray standing in the synagogues and in the corners of the streets, that they may be seen of men. Verily I say unto you, They have their reward.

Interlinear KJV

And /kai/ when /hotan/ thou prayest, /proseuchomai/ thou shalt /esomai/ not /ou/ be /esomai/ as /hosper/ the hypocrites /hupokrites/ are: for /hoti/ they love /phileo/ to pray /proseuchomai/ standing /histemi/ in /en/ the synagogues /sunagoge/ and /kai/ in /en/ the corners /gonia/ of the streets, /plateia/ that /hopos/ they may /an/ be seen /phaino/ of men. /anthropos/ Verily /amen/ I say /lego/ unto you, /humin/ /hoti/ They have /apecho/ their /autos/ reward. /misthos/

Albert Barnes’ Commentary

Verse 5. And when thou prayest, etc. Hypocrites manifested the same spirit about prayer as alms-giving: it was done in public places. The word synagogues, here, clearly means not the place of worship of that name, but places where many were accustomed to assemble— near the markets, or courts, where they could be seen of many. Our Lord evidently could not mean to condemn prayers in the synagogues. It might be said that he condemned ostentatious prayer there, while they neglected secret prayer; but this does not appear to be his design. The Jews were much in the habit of praying in public places. At certain times of the day they always offered their prayers. Wherever they were, they suspended their employment, and paid their devotions. This is also practised now everywhere by the Mohammedans, and in many places by the Roman Catholics. It seems, also, that they sought publicity, and regarded it as proof of great piety. {o} “they have their reward” Pr 16:5; Jas 4:6