How can I convert a list of title-posts into a sequence of comma separated text? [closed]

If you want to keep them all within one outer <li>, you can use something like this. Instead of echoing them immediately, save them to an array, then loop through the array.

<?php
if ($autores->have_posts()):
    echo '<li>';
        // create an empty array
        $autoresArray = array();
        while($autores->have_posts()): $autores->the_post();
            // save the link and name
            $autoreLink = get_permalink();
            $autoreName = get_the_title();
            // now add them to a multidimensional array
            $autoresArray[] = array(
                'link' => $autoreLink,
                'name' => $autoreName,
            );
        endwhile;
        // outside of 'while' so we only display the author list once
        for($i=0; $i<count($autoresArray); $i++) {
            // display the linked name
            echo '<a href="' . $autoresArray[$i]['link'] . '">' . $autoresArray[$i]['name'] . '</a>';
            // if it's not the last name in the array, add comma and space
            if($i != (count($autoresArray)-1)) {
                echo ', ';
            }
        }
    echo '</li>';
endif;
?>