You should be able to typecast the variable like so:

$cardID = (int)$cardID;

You can also check which type it is showing up as with the function gettype():

http://www.php.net/manual/en/function.gettype.php

Optionally you could use settype() to change the type of the variable:

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

HTH

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099

On Friday 20 January 2006 03:53 pm, Ron Eggler (Paykiosks) wrote:
> Hi,
>
> I need to do a type cast from string to int in folllowing code:
> [php]
> <getPIN cardID="'.intval(trim($cardID)).'" quantity="1" />
> [/php]
> I need $cardID have converted to int. I thought it should work that way
> but it does not!
> But it's working if I'm putting
> [php]
> <getPIN cardID="180" quantity="1" />
> [/php]
> in there. I got card ID as a var that is passed as get like:
> [php]
> $cardID = $HTTP_GET_VARS[cardID];
> [/php]
>
> Can anyone help me in that issue? Thank you!
>
> __________________________________________
>
> Ron Eggler
> Intern
> 866-999-4179
> www.paykiosks.net

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

Reply via email to