The function get_post_types( '', 'names' )
returns an array containing the names of post types.
<?php
$post_types = get_post_types( '', 'names' );
foreach ( $post_types as $post_type ) {
echo '<p>' . $post_type . '</p>';
}
?>
Read more here: How can I insert an PHP array into HTML dropdown?