Function to protect content in PHP

Hello, I am in need of a function that will gave the same functionality as [ms-protect-content] I already tried to use:
echo do_shortcode('[ms-protect-content id="38922"]');
I was looking on the forums for a solution with no luck but did find this:
https://premium.wpmudev.org/forums/topic/how-to-restrict-access-using-the-do_shortcode-function-in-php
That is exactly what I need except I need it for Protected Content and not Membership Pro.
Thanks for all the help! I hope there is a simple solution for this.