Help to correct code for a posts text hiding

Hello,

I want to add a tag <–hide–> to hide posts text after it for unregistered users and show a phrase like “To read a full article text - please, Register”. For a such purpose I create a micro plugin. But it does not work.

function hide_replace_register( $content ) {
	$updated_content = explode("<!--hide-->", $content);
	$updated_content = explode("&lt;!--hide--&gt;", $content);
	$updated_content = explode("&lt;!&#8211;hide&#8211;>", $content);
	$ucontent = $updated_content[0];
	if ($ucontent !== $content) {
		$ucontent .= '<a href="' . wp_registration_url() .'"><strong>To read a full article text - please, Register</strong></a>';
	} else {
		$ucontent = $content;
	}
	return $ucontent;
}
add_filter('the_content', 'hide_replace_register', 10);

Can you please help to correct a bug?

Please, help someone!