note 80280 deleted from ref.math by felipe

From: Date: Mon, 04 Feb 2008 20:24:31 +0000
Subject: note 80280 deleted from ref.math by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135771@lists.php.net to get a copy of this message
Note Submitter: Mike ---- Just a simple function to trim digits from the left side of an integer. TRIM DOWN TO 4-> (ie. 987654 => 7654) function trimInteger($targetNumber,$newLength) { $digits = pow(10,$newLength); $s = ($targetNumber/ $digits); //make the last X digits the decimal part $t = floor($tradeID / $digits); //drop the last X digits (the decimal part) $h = $s - $t; //remove all but the decimal part $newInteger = ($h*$digits); //make the everything after the decimal point the new number return $newInteger; }

« previous php.notes (#135771) next »