How to get the output content from the_content() or get_the_content() in WordPress and capture it in a PHP variable?

This is easily achieved by this approach:

PHP Code:
ob_start();
the_content();
$content ob_get_clean();
// do something about $content
echo $content
Nice and easy.