Converting integer type to long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I'm facing a little problem here. I'm making a few query using SOAP
protocol (NuSOAP class), that involves sending out an amount (e.g.
0.01), which is accepted in type of [long] in its WSDL, for recording
purpose. Typical call:

[code]
$param = array('rewardSchemeId'=> $tnt_rewardSchemeId,
                'accountNumber' => $acountNumber,
	        'amount'        => $amountIgnoringDecimalPoint) );

$result = $soap->call('recordBooking', $param);
[/code]

The problem is, I have not been able to convert PHP's integer/float type
to long because there is no function that does it. Or is there?

I've tried using settype() and (type) casting, but to no avail. I've
read a user's contribution note in PHP Manual for settype(), and he said:

"It's worth noting that one can neither <I>settype()</i> nor type-cast a
variable as a long.  The workaround for this seems to be to use
<I>pack()</i>."

I've looked at pack() function and tried it but I don't think I'm
getting it right because the instruction is not clear to me ( I don't
have programming background). I've done the following:

$amount = pack('L', $amount);

Please assist. Thanks.




-- 
Wee Keat Chin

Protocol Networks
p: 1300 131 932
e: weekeat@xxxxxxxxx
h: www.pn.com.au

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux