What is the difference between rambam, shulchan aruch, mishnah brurah, pninei halacha?
The Rambam’s Yad Hachazaka was the first truly systematic compilation of Jewish Law, that although initially was met with reservations, has been accepted worldwide. However, its compilation and its style of of codification, most notably being without sources raises with it a large amount of issues, as many commentators had no idea where the Rambam derived his conclusion. This led to a myriad of interpretations, and divergent opinions being quoted.
Furthermore the Rambam largely ignored other opinions (most notably the French Tosafists), as was his right for obvious reasons. But from a halachic perspective this would leave the sugya (topic) severely lacking.
Wikipedia on this:
Maimonides intended to provide a complete statement of the Oral Law, so that a person who mastered first the Written Torah and then the Mishneh Torah would be in no need of any other book. Contemporary reaction was mixed, with strong and immediate opposition focusing on the absence of sources and the belief that the work appeared to be intended to supersede study of the Talmud. Maimonides responded to these criticisms, and the Mishneh Torah endures as an influential work in Jewish religious thought. According to several authorities,2 a decision may not be rendered in opposition to a view of Maimonides, even where he apparently militated against the sense of a Talmudic passage, for in such cases the presumption was that the words of the Talmud were incorrectly interpreted. Likewise: "One must follow Maimonides even when the latter opposed his teachers, since he surely knew their views, and if he decided against them he must have disapproved their interpretation."
Thus enters the Shulchan Aruch, or prior to that the Tur Shulchan Aruch which was an attempt to blend the learning styles of the Rif (who lived before the Rambam), his father the Rosh (who lived in both among the Ashkenazim and the Spanish Sefardim) and the Baalei Hatosfos, the Ashkenazi commentaries on the Talmud
Wikipedia explains this quite well:
In the Arba'ah Turim, Rabbi Jacob traces the practical Jewish law from the Torah text and the dicta of the Talmud through the Rishonim. He used the code of Rabbi Isaac Alfasi as his starting point; these views are then compared to those of Maimonides, as well as to the Ashkenazi traditions contained in the Tosafist literature. Unlike Maimonides' Mishneh Torah, the Tur is not limited to normative positions, but compares the various opinions on any disputed point. (In most instances of debate, Rabbi Jacob follows the opinion of his father, Rabbi Asher ben Jehiel, the Rosh.) The Arba'ah Turim also differs from the Mishneh Torah, in that, unlike Maimonides' work, it deals only with areas of Jewish law that are applicable in the Jewish exile.
A further difference is that the Rambam dealt with laws that didn’t apply in the Jewish exile, but the Tur was limited only to laws applicable B’zman Hazeh (as with the rest of the works explained below)
The most prominent commentary on this work, the Tur Shulchan Aruch, is the magnum opus of Rav Yosef Karo, known as the Beis Yosef, which attempts to review all the relevant material and come to a final conclusion, something that the Tur Shulchan Aruch did not always do.
However the Beis Yosef was a long, running commentary that was very hard to fully digest, especially if it was meant to come to a final practical conclusion. Therefore, Rav Yosef Karo authored the Shulchan Aruch, as we know it today, which is a summation of the Beis Yosef. This has been accepted as the defacto halachic work, and all halacha that is decided today uses it as a jumping off point.
The Mishna Berurah, compiled by the Chofetz Chaim, his son and his students, is considered by many (most prominently, Rav Ahron Kotler zt”l and the Chazon Ish zt”l) as the posek acharon (final halachic decisor) for our generation, and thus binding on everyone (or at least Bnei Ashkenaz). Famously Rav Moshe Feinstein and Rav Yosef Eliyahu Henkin disgareed and held that it was the Aruch Hashulchan. But even they agreed that the Mishna Berurah decisions needed to be reckoned with and not easily ignored or disgarded. The Mishna Berurah, like most modern day halachic works, attempts to apply the decisions of the Shulchan Aruch to modern day situations. For the Chofetz Chaim was a rare figure that has been accepted as a Tzaddik and a Scholar by literally all the Jewish People.
The Peninei Halacha, authored by a modern-day Rabbi - Rav Eliezer Melamed, is a compilation of halachos, including summaries, but also features modern day questions that were not discussed in the Shulchan aruch itself, but applies the Shulchan aruch, and other sources as well to these new questions.
However, Rav Melamed, recognized as a Talmid Chacham, is not a widely accepted authority that his halachic decisions are considered binding (as opposed to the Shulchan Aruch). However, if you consider him to be your Rav, that is your choice, just as someone may accept upon himself the psakim of Rav Ovadia, or Rav Shlomo Zalman (though they both are greatly more accepted among a larger swath of the Jewish people than Rav Melamed). Obviously this means that you may not pick and choose when to follow his opinions or not. As once you have accepted him as your authority it is binding. (This is admittedly not a simple issue, consult your local Rav)