Reply to RE: [PHP] String -> Number Automatic Conversion

Your name:

Reply:


Posted by Richard Lynch on 10/04/43 11:07

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

[Back to original 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

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