You are here: Re: [PHP] Str to Int « PHP « IT news, forums, messages
Re: [PHP] Str to Int

Posted by Ray Hauge on 01/21/06 01:04

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация