RE: PHP Java problem

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

 



Hi

php has very loose typing. This means that you can use a string as a number
and visa versa. You could for example do (substr("1 day",0,1) + 5) and get
the answer 1+5=6

php actually converts on the fly to do the above. The downside is that you
cannot always be sure what type a variable is. Form variable are always
strings, even if they are numbers.

I am not a java engineer either but "argument type mismatch" might be that
you are  passing a string when it expects a number or visa versa.

Try using settype() to force the type

http://uk2.php.net/manual/en/function.settype.php

and see if this fixes it.

Just a guess though, hope it helps

Peter





-----Original Message-----
From: Donovan Hutchinson [mailto:djpreach@xxxxxxxxxxx]
Sent: 13 January 2004 20:49
To: php-db@xxxxxxxxxxxxx
Subject:  PHP Java problem


Hi,

I've started putting together a site that uses PHP to access some custom
Java classes. While I'm not clear on what exactly the java classes are
doing, the programmer has given me an overview of the variables that I
should pass to them. However, I keep getting this error:

java.lang.IllegalArgumentException: argument type mismatch

The java programmer has no knowledge of PHP and so is unable to help locate
the source of the problem (tbh I'm don't have experience in large php
projects myself). The code I'm writing is in the following format:

$newobject = new Java('com.company.Class', $names, (String) $ssn, (int)
$time);

In the above example, $names is an object, $ssn a string and $time an
integer. The object $names is created in a similar way above this example.
Someone mentioned that I should be passing objects as arrays, but I'm not
clear on how this is done.

I've tested a very basic class to be sure it works, and had success, however
when I try to pass objects into classes, and multiple variables, it doesnt
work. I hope someone can shed some light on where I might be going wrong.

Many thanks,

Don

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux