 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
camoman666

Joined: 24 Jun 2006 Posts: 362 Location: Fort Walton Beach, FL, USA
|
Posted: Mon Jan 01, 2007 5:46 pm changing a string into an int |
|
|
|
| You can pretty much guess what I want to do from the title but how would u change a string that contains only numbers into an int? |
|
Thor Erik
Joined: 30 Dec 2006 Posts: 8
|
Posted: Thu Jan 04, 2007 12:25 pm |
|
|
|
if i don't remember wrong, php is so smart it auto detects(it dose for me on php5) but you can add int() to the string. eg:
| Code: |
$some_var = "131"; //a string
(int)$some_var; //should make it a interger if i'm not totally mistaking |
just for reference:
http://no.php.net/manual/en/function.is-int.php |
|
LAN_Rover

Joined: 06 Feb 2006 Posts: 19 Location: Petawawa, Ontario, CANADA
|
Posted: Sun Apr 15, 2007 11:47 am Re: changing a string into an int |
|
|
|
| camoman666 wrote: |
| You can pretty much guess what I want to do from the title but how would u change a string that contains only numbers into an int? |
Straight from the php website:
| Quote: |
| PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which that variable is used. |
In other words variables don't have types.
http://ca.php.net/manual/en/language.types.type-juggling.php[/quote] |
|
Pattons3rd

Joined: 28 Dec 2006 Posts: 1212 Location: Colorado
|
Posted: Mon Apr 16, 2007 5:26 am |
|
|
|
I think that means that the variables don't have set types, they are used as any that you need.
You can turn them back and forth.
That is just what I am guessing. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|