HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
changing a string into an int
Post new topic   Reply to topic    HTML Help Forum Index -> PHP
View previous topic :: View next topic  
Author Message
camoman666



Joined: 24 Jun 2006
Posts: 362
Location: Fort Walton Beach, FL, USA

PostPosted: Mon Jan 01, 2007 5:46 pm     changing a string into an int Reply with quote

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

PostPosted: Thu Jan 04, 2007 12:25 pm     Reply with quote

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

PostPosted: Sun Apr 15, 2007 11:47 am     Re: changing a string into an int Reply with quote

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

PostPosted: Mon Apr 16, 2007 5:26 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> PHP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial