Re: Newbie question: convert string to int
| From: | graeme | Date: | Tue, 18 Jan 2005 05:17:37 +0000 |
| Subject: | Re: Newbie question: convert string to int | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-25366@lists.php.net to get a copy of this message | ||
If you note in my text I had said number. 5.7 is a number. If you want to convert the number to an integer then there are a number of php functions to do that. It all depends on how you want the conversion to be done but a type cast (int) will eventually be necessary.
graeme
BENJAMIN LAMBE wrote:
dont mean to be padantic, but 5.7 is not an integer :p lol -----Original Message----- From: graeme <graeme_foster@sherubtse.edu.bt> To: Louis Young <louis@kwikpay.co.za> Date: Mon, 17 Jan 2005 13:47:49 +0600 Subject: Re: [PHP-WIN] Newbie question: convert string to int If you are holding a string with a valid number in it e.g. "5.7" then the conversion is done automatically. See the manual section Language Reference / Types / Strings / String conversion to numbers. If you are holding a string with the number in words e.g. "Five" then you'll need to write your own function for that. graeme Louis Young wrote:-- Experience is a good teacher, but she sends in terrific bills. Minna AntrimHi there What's the function to convert a string to an int. Cheers Louis