|
Posted by Wee Keat on 08/03/05 07:54
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@pn.com.au
h: www.pn.com.au
[Back to original message]
|