我有几句话,其价值是“53ILL”。
$number="53 MILLION";
我想这个数字是53 000 000 000美元。 如何做到这一点? 我使用“原状”功能,但无uck。
提前感谢!
$number="53 MILLION";
$number= str_replace($number, "MILLION", "000,000");
echo $number; //000,000 instead of 53,000,000
我有几句话,其价值是“53ILL”。
$number="53 MILLION";
我想这个数字是53 000 000 000美元。 如何做到这一点? 我使用“原状”功能,但无uck。
提前感谢!
$number="53 MILLION";
$number= str_replace($number, "MILLION", "000,000");
echo $number; //000,000 instead of 53,000,000
在耶稣所说的基础上,建立这些数字的简单功能是:
function declare_number($number_string){
$find_replace = array(
HUNDRED => 00 ,
THOUSAND => ,000 ,
MILLION => ,000,000 ,
BILLION => ,000,000,000
);
return str_ireplace(array_keys($find_replace),$find_replace,$number_string);
}
这也能够转换为8亿人=80万人。
为什么不要把你的扼杀分开,在你的阵列中寻找“ILL”,然后将其换成“000 000”,然后将其全部归回呢? 我恳请你利用空间进行分裂。
如果你只有100万人,就使用:
$number = str_replace( million , 000000 , $number);
不知道购买力平价,但算法
用于“5 300万、2 100万和8 100万”的Algorithm:
Size String Translation Table = [{"Million", 1000000},{"Thousand", 1000}, etc...]
counter = 0
--Scan from top of string to end:
----until comma
------scan integer - "53"
------scan size string - "Million"
------multiply integer by size string translation - "53 * 1000000"
------Add to the main counter - counter += "53000000"
----loop
--end
Depends how example is your question
Your real case could be:
convert 53 MILLION 39 TOUSEND 334
into 53,039,334
etc.
因此,算法是要在有数字的地方打脚石,记住它。 <代码> THOUSEND, MILLION, 等 , 即可乘你身边的脚步和编号。 最后,加上不成倍的东西。 之后,你有数字。
Convert the number into number-string (53039334) and, going from end, after each 3 digits add coma, and here you have what you need :)
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!