ACF put a comma after the last repeater field value [closed]

You’re generating whitespace because of the blank line between the echo $end block and the endwnile, and because you’re switching in and out of PHP which means everything between the ?> and <?php – i.e. all of the whitespace – will get echoed out. (HTML then merges the blank lines and spaces into a single space for display.)

You can just do this a single PHP block to save switching in and out of PHP, which will prevent any extra whitespace getting echoed:

<?php
if (have_rows('ore')) {
    while(have_rows('ore')) {
        the_row();

        $start = get_sub_field('start');
        $end = get_sub_field('end');

        if( get_row_index() != 1 ) {
            echo "https://wordpress.stackexchange.com/";
        }
        echo esc_html($start).' - '.esc_html($end);
    }
    echo ',';
}
?>

Note that I’ve also added esc_html() around the $start and $end values as you echo them. I might also check if these were present or not too before using them, unless you’re positive they’ll always have values.

tech