MGCJerry
06-01-2002, 09:58 PM
I know this can be done, cause I see it here. I'm writing a php script, and with a particular result (very high number) I'd like to have commas in it, but I dont know how to start...
Here is some of the code, the resulting number for "$gnp" is up into the billions, and I'd like to to be easer read with some commas in the final result (ex 1,234,787,764.66). I know this is possible because I see it every day on WHT (example on WHT homepage: Total Threads: 50,854).
This script generates a page that can be directly entered into my nuke site. This is one of many "conversion" scripts I have written which helps me paste the HTML data into my site's database. The "Encyclopedia" in phpnuke doesnt like any spaces between any HTML tags (which makes WYSIWYG editors out of the question as I had to manually delte all spaces between all HTML tags). If you ever used php-nuke and wanted tables in the "Encyclopedia", you'll know what I mean ;).
<?PHP
include("includes/planet.txt");
$pop = $adrothian + $forestinian + $helfin + $human +
$hydratie + $isitolie + $leenin + $magmadon + $morsenian +
$phayon + $quizorthian + $sarian + $septian + $sivadffejian +
$zelenitorian + $other;
$gnp = $income * $pop;
print "<title>Conversion for $pltname</title>\n";
$tmpl_file = "includes/pltemp.html";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"".$thefile."\";";
eval($thefile);
print $r_file;
?>
Any help would to add commas to the result for "$gnp" be really appreciated. The script is run locally so the processing time isn't too important.
Edit I had to put the equation for "$pop" on different lines so you wouldnt need to scroll waaaaaaaaaaaaay to the right ;)
/edit
Here is some of the code, the resulting number for "$gnp" is up into the billions, and I'd like to to be easer read with some commas in the final result (ex 1,234,787,764.66). I know this is possible because I see it every day on WHT (example on WHT homepage: Total Threads: 50,854).
This script generates a page that can be directly entered into my nuke site. This is one of many "conversion" scripts I have written which helps me paste the HTML data into my site's database. The "Encyclopedia" in phpnuke doesnt like any spaces between any HTML tags (which makes WYSIWYG editors out of the question as I had to manually delte all spaces between all HTML tags). If you ever used php-nuke and wanted tables in the "Encyclopedia", you'll know what I mean ;).
<?PHP
include("includes/planet.txt");
$pop = $adrothian + $forestinian + $helfin + $human +
$hydratie + $isitolie + $leenin + $magmadon + $morsenian +
$phayon + $quizorthian + $sarian + $septian + $sivadffejian +
$zelenitorian + $other;
$gnp = $income * $pop;
print "<title>Conversion for $pltname</title>\n";
$tmpl_file = "includes/pltemp.html";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"".$thefile."\";";
eval($thefile);
print $r_file;
?>
Any help would to add commas to the result for "$gnp" be really appreciated. The script is run locally so the processing time isn't too important.
Edit I had to put the equation for "$pop" on different lines so you wouldnt need to scroll waaaaaaaaaaaaay to the right ;)
/edit
