Support

Account

Home Forums ACF PRO Insert dots and $ sign if is a number Reply To: Insert dots and $ sign if is a number

  • With the next code, I have $0

    <?php $valor1 = get_sub_field('valor1');
    if (intval($valor1) == $valor1) {
    	$valor1 = '$'.number_format(intval($valor1, ',', '.'));
    }
    echo $valor1;
    ?>

    With the next code, I have: 260000$0

    <?php if ( have_rows( 'valores' ) ) : ?>
    <?php while ( have_rows( 'valores' ) ) : the_row(); ?>
    	<?php
    	$valor1 = the_sub_field('valor1');
    	if (intval($valor1) == $valor1) {
    		$valor1 = '$'.number_format(intval($valor1, ',', '.'));
    	}
    	echo $valor1;
    	?>
    <?php endwhile; ?>
    <?php endif; ?>

    Thx