• 05-04-2014, 02:33:41
    #1
    Reveloper
    Şu şekilde bi hesaplama nasıl yaparız


    200 Onaylanan Sipariş
    100 İptal Edilen Sipariş
    100 Destek Talebindeki Sipariş

    bunu php şu şekilde vericek bana:

    %50 Onaylanan Sipariş | %25 İptal Edilen Sipariş | %25 Destek Talebinde Sipariş

    yani bunları bölecek? fonksiyona dökmek istiyorum bunu nasıl yapacağım?
  • 05-04-2014, 03:57:17
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @Burti;
    <?php
    	
    	$tickets = array(
    		"accepted" => 500,
    		"declined" => 100,
    		"support" => 400
    	);
    	
    	$total = 0;
    	
    	foreach($tickets as $ticket)
    	{
    		$total += $ticket;
    	}
    	
    	echo "Accepted: " . (100 - ($total - $tickets["accepted"]) * 100 / $total) . "%\n";
    	echo "Declined: " . (100 - ($total - $tickets["declined"]) * 100 / $total) . "%\n";
    	echo "Support: "  . (100 - ($total - $tickets["support"]) * 100 / $total)  . "%\n";