我不知道如果我正確地做到這一點,用函數defaultcoindload()預加載硬幣的數組值。預加載函數的數組值
defaultcoindload();
function defaultcoindload()
{
/*Have the coin loads up to a maximum of a 1.00 dollar in value:
An associative array-ID key is associated with value(ID is Nickels with value of 20).
$money = array("Nickels"=>20, "Dimes"=>10, "Quarters"=>10);
The array code for $money above is the same as the array code below,
with the difference being the structure and the ID keys can be accessed in a script*/
if ($money < 1.00)
{
echo "money";
}
else if($money = $insertcoins[$selection])
{
echo "$selection";
}
$money['Nickels'] = "20";
$money['Dimes'] = "10";
$money['Quarters'] = "10";
echo "The value of Nickels is " . $money['Nickels'] ." cents.";
而且是它甚至法律要做到這一點:
function getselection($selection,$price)
{
具有原始功能defaultcoinload()內其他功能或多種功能,我認爲它是隻需要一點點澄清,謝謝,不要燃燒。
你能提交完整的功能代碼嗎?似乎你錯過了一些代碼行... – 2009-11-21 02:26:48
你的代碼對我來說沒有意義。也許你必須添加一些其他的代碼行。什麼是$ insertcoins? $ money是一個全局變量(php需要使用全局關鍵字來顯式擴展函數範圍)? – Eineki 2009-11-21 02:44:03