난 그냥 마지막 값을 인쇄하려면,하지만 그들 모두를 인쇄 :WHILE 루프에서만 마지막 값을 얻으려면 어떻게해야합니까?
<?php if (get_field('share_sentiment')):?>
<?php while (has_sub_field('share_sentiment')):?>
<?php if (get_sub_field('share_medium')):?>
<?php $kid = 0; ?>
<?php while (has_sub_field('share_medium')):?>
<?php
$negative += get_sub_field('medium_negative');
$positive += get_sub_field('medium_positive');
$totalMinus = ($positive - $negative)/($positive + $negative);
$rounded = round($totalMinus, 3);
print_r($rounded);
?>
<?php endwhile;?>
<?php endif;?>
<?php endwhile;?>
<?php endif;?>
이것은 기본적인 프로그래밍 논리입니다. 이해할 수 없어도 시도해 보면 알 수 있습니다.이 코드를 볼 때 프로그래밍을 이해할 수 있는지 의심 스럽습니다. 먼저 PHP 설명서를 검색하십시오. –
html이 포함되지 않은 경우 php 태그를 여러 번 열고 닫는 이유는 무엇입니까? – Shubanker
Oh my $ DEITY, 이렇게 코드를 작성하지 마십시오. –