Is there a way to optimize this code?
#1

Hello guys, I want to devide this string "21.99" into two part, cash: "21" and coin: "99". I do this and it works, but I think it may be slow. Can you help me optimize it?

PHP код:
new _money[11] = "21.99",
        
cash[11],
        
coin[3],
        
_cash,
        
_coin,
        
dot;
    
dot strfind(_money".");
    if(
dot != 1)
    {
        
strmid(cash_money0dot);
        
strmid(coin_moneydot+1dot+3);
        
_cash strval(cash);
        
_coin strval(coin);
        
printf("money: %s, cash: %d, coin: %d"_money_cash_coin);
    } 
Output:
Quote:

money: 21.99, cash: 21, coin: 99

Thanks in advanced.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)