RE: String -> Number Automatic Conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nuzzo Art-CINT116 wrote:
>> Possible work-around:
>> I suspect that
>> $p1[14] = "-0.15" + 0;
>> will do what you want, since the leading 0 will probably
>> trigger the regex properly.
>>
>> Try it and see.
>
> Changing it to -0.15 + 0 works.  This data is actually coming from a
> numeric field in an Oracle database using the OCI interface so I am not
> sure why it's a string instead of a number but that's a separate issue I
> need to look into.

I'm not certain about OCI or others, but generally PHP database extensions
retrieve all data as text...

At least, the last time I checked on that, that's what it was...

Could be wrong or out of date.

Rarely worry about data type in PHP, once you understand the type juggling
and conversion rules.

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux