[wd_asp elements=’search’ ratio=’100%’ id=1]

Percentage

10th December 2013

Php - Strings

php codehaven

To find 30% of a variable

// $budget = 100;
$thirtypercent = ($budget * 30 /100);

//$thirtypercent will equal 30

Most of the time is *100, but here it is…..
$x = 3;
$y = 15;

$percent = $x/$y;
$percent_friendly = number_format( $percent * 100, 2 ) . '%';