SportTipsWorld saidYes, you may use it, you’re welcome
s4nji saidSanji thats pretty awesome work, may i use your code too. thankyou
Here, I made one with preg_match_all, pretty much worked
![]()

What is code, for adding a var and echoing it out using the code you made please, just as a sample.
SportTipsWorld said
What is code, for adding a var and echoing it out using the code you made please, just as a sample.
echo denominate($_GET['n']);Why do you ask?
s4nji said
SportTipsWorld said
What is code, for adding a var and echoing it out using the code you made please, just as a sample.echo denominate($_GET['n']);Why do you ask?
I must be having a brain fart ( its late and been a long day )
<?php
$numb ='125678767';
function denominate($number) {
// Define the denominators
$value = array( 'thousand','million','billion','trillion' );
// Use preg_match_all to gather datas
$pattern = '/(\d+),(.+)/';
preg_match_all( $pattern, $number, $result );
// Get the first block of numbers
$main = $result[1][0];
// Get and specify the text for the value denominator
$sub = substr_count( $result[2][0], ',' );
$sub = $value[$sub];
// Get the 'numbers behind the comma'
$float = str_replace ( ',', '', $result[2][0] );
$float = round( $float, 2 - strlen( $float ) );
$float = substr( $float, 0, 2 );
// Output
return "$main,$float $sub";
}
?>
<?php echo denominate($_GET['numb']); ?>
$number = '12,345,678,901';
function denominate($number) {
// Define the denominators
$value = array( 'thousand','million','billion','trillion' );
// Use preg_match_all to gather datas
$pattern = '/(\d+),(.+)/';
preg_match_all( $pattern, $number, $result );
// Get the first block of numbers
$main = $result[1][0];
// Get and specify the text for the value denominator
$sub = substr_count( $result[2][0], ',' );
$sub = $value[$sub];
// Get the 'numbers behind the comma'
$float = str_replace ( ',', '', $result[2][0] );
$float = round( $float, 2 - strlen( $float ) );
$float = substr( $float, 0, 2 );
// Output
return "$main,$float $sub";
}
echo denominate($number);
You don’t know how to use functions?
You are having a brain fart, or… 
By the way, the inputted numbers must be separated with comma manually, like the numbers you wrote at your first post.
Thanks, I never mentioned I knew what i was doing ! lol
s4nji said
Here, I made one with preg_match_all, pretty much worked
I’m not a big fan of preg_match but it works out really great. Good job. 
