Search
 
SCRIPT & CODE EXAMPLE
 

PHP

take fraction of number in laravel

$price = 350.32;

$whole = intval($price); // 350
$decimal1 = $price - $whole; // 0.3200000000005 
$decimal2 = round($decimal1, 2); // 0.32 this will round off the excess numbers
$decimal = substr($decimal2, 2); // 32 this removed the first 2 characters

if ($decimal == 1) { $decimal = 10; } 
if ($decimal == 2) { $decimal = 20; } 
if ($decimal == 3) { $decimal = 30; }  
if ($decimal == 4) { $decimal = 40; }
if ($decimal == 5) { $decimal = 50; }
if ($decimal == 6) { $decimal = 60; }
if ($decimal == 7) { $decimal = 70; }
if ($decimal == 8) { $decimal = 80; }
if ($decimal == 9) { $decimal = 90; }
Comment

PREVIOUS NEXT
Code Example
Php :: Google Dorks Using special search string to find vulnerable websites: 
Php :: magento debug white page 
Php :: mySQL phpMyAdmin with Google Chrome: stuck on loading 
Php :: capitlise php 
Php :: wordpress display post comment number 
Php :: laravel update from query 
Php :: create array from string with commas php 
Php :: php replace 
Php :: laravel custom error page 
Php :: phpspreadsheet applyFromArray wrap 
Php :: check php version 
Php :: laravel exists validation query two tables 
Php :: php first 20 words 
Php :: select sum in laravel 
Php :: laravel collection implode 
Php :: php check if string or number 
Php :: isset blade laravel 
Php :: add array to another array in laravel collection 
Php :: Laravel loop iternation pagination issue 
Php :: php Call to undefined function mb_convert_case() 
Php :: php base64 encoded image to png 
Php :: php.validate.executablepath wamp 
Php :: php favicon 
Php :: php get first last loop 
Php :: codeigniter form_validation email 
Php :: minuscule string php 
Php :: add column migration laravel 
Php :: laravel get full url with parameters 
Php :: Target class [FruitcakeCorsHandleCors] does not exist. 
Php :: Notice: Undefined property: 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =