|
From: <php...@li...> - 2008-09-03 19:51:38
|
Hi,
> Try:
> $res = (bool) $IDEAS->isValidAccountNumber($acctnum) ;
No! PHP automatically casts a primitive value into a boolean, if it is part of the boolean expression. However, you cannot convert a PHP object into PHP value using a type cast. The only exception is the (string) type cast, which internally calls $res->__toString()[1].
Therefore the PHP/Java Bridge library contains two special procedures, one to fetch a PHP value from a Java object, the other one to cast a Java object into a PHP primitive type. Please see our documentation for details.
Regards,
Jost Boekemeier
[1] PHP's behaviour is insane, of course. In order to convert the following PHP object into a value one needs two type casts:
class Clazz_ONE {
function __toString() { return "1"; }
}
$one = new Clazz_ONE();
var_dump( (int) $one)
=> ERROR
var_dump( (int)(string) $one)
=> 1
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|