Function java_cast
Converts the java object obj into a PHP value.
This procedure converts the Java argument and then calls java_values() to fetch its content. Use java_values() if the conversion is not necessary.
The second argument must be [s]tring, [b]oolean, [i]nteger, [f]loat or [d]ouble, [a]rray, [n]ull or [o]bject (which does nothing).
Example:
$str = new java("java.lang.String", "12"); echo is_string ($str) ? "#t":"#f"; => #f $phpString = (string)$str; echo is_string ($phpString) ? "#t":"#f"; => #t $phpNumber = (integer)(string)$str; echo $phpNumber; => 12 $phpNumber2 = java_cast($str, "integer"); echo $phpNumber2; => 12
object |
$object |
java object |
string |
$type |
PHP type description, either [Ss]tring, [Bb]oolean, [Ll]ong or [Ii]nteger, [Dd]ouble or [Ff]loat, [Nn]ull, [Aa]rray, [Oo]bject. |