Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php calculate percentage

$percentage = 50;
$totalWidth = 350;

$new_width = ($percentage / 100) * $totalWidth;
Comment

percentage in php

<?php
// How much is the x percentage of given value

$percentage = 10;
$totalValue = 500;

// 10% of 500
echo $newValue = ($percentage*$totalValue)/100;
Comment

PHP program to Calculate Percentage

// defining function
 function calPercentage($num, $total) {
  $count1 = $num_amount / $num_total;
  $count2 = $count1 * 100;
  $count = number_format($count2, 0);
  return $count;
}

// call function to calculate percentage
echo "Percentage of 100 in 1000 = ".calPercentage(100, 1000).'%<br/>';
echo "Percentage of 26 in 200 = ".calPercentage(26, 200).'%<br/>';
echo "Percentage of 30 in 400 = ".cal_percentage(30, 400).'%<br/>';

Output 
Percentage of 100 in 1000 = 10%
Percentage of 26 in 200 = 13%
Percentage of 30 in 400 = 8%
Comment

calculate percentage of amount in php

//ENTER  PERCENT AND AMOUNT 
//IT WILL RETURN OUTPUT
//INTAKE: 2% OF 10
//OUTPUT : 0.2
function calc_percent($percent, $amt) {
  return  $output = ($per/100 * $amt);
}
Comment

percentage in php

$percentage = 10; //persentage
$totalWidth = 1000; //Summa

$new_width = ($percentage / 100) * $totalWidth;
Comment

PREVIOUS NEXT
Code Example
Php :: wp php redirect my account page url to custom url 
Php :: select max id laravel 
Php :: php uppercase with accent 
Php :: creer un modele laravel 
Php :: php list all constants 
Php :: require in php 
Php :: php eliminar elementos vacios array 
Php :: yii2 activeform 
Php :: how to redirect to another page in php 
Php :: install php 5.6 on ubuntu 18.04 
Php :: phpcs ignore line warning 
Php :: php check if value exists in multidimensional array 
Php :: larvel make http request 
Php :: IlluminateDatabaseEloquentCollection to array 
Php :: codeingiter 3 where in 
Php :: cakephp 2.x join 
Php :: from user id to user role wordpress 
Php :: $errors show this error in laravel 
Php :: laravel merge collections 
Php :: public_path laravel 
Php :: check if index exists in array php 
Php :: Regex For Iranian Phone Numbers 
Php :: how to send data from one website to another in php 
Php :: php add property to object 
Php :: php color generator 
Php :: catch any exception php 
Php :: php hello world 
Php :: laravel online hash password generator 
Php :: wp_create_user 
Php :: php redirect seconds 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =