Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php calculate percentage

$percentage = 50;
$totalWidth = 350;

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

increase the number in php by a certain percentage

$price = $price + ($percentage / 100 ) * $price
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 :: laravel query order by relation 
Php :: php remove non utf-8 characters 
Php :: php function crop image 
Php :: replace text in string php 
Php :: grouping routes based on controller 
Php :: load-styles.php 403 
Php :: php ?? 
Php :: wp_cache_get 
Php :: php ip log 
Php :: new session php 
Php :: model find by certain column laravel 
Php :: find days with name between two dates in php 
Php :: php get first character of each word 
Php :: PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() 
Php :: php current time 
Php :: include() in php 
Php :: factory laravel laravel 8 tinker 
Php :: php array viewer 
Php :: get last element of array php 
Php :: get all post 
Php :: custom autoload without composer 
Php :: how to trim string in laravel 
Php :: wordpress get post date 
Php :: php artisan tinker encryption cmd 
Php :: how to call php function from ajax 
Php :: php strlen 
Php :: symlink.php laravel 
Php :: laravel valet refresh env 
Php :: disable display error 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =