Reply to Re: WTF? String = Integer in PHP? Strlen() in integers WORKS? HELP!

Your name:

Reply:


Posted by Colin McKinnon on 02/05/06 23:54

Justin Koivisto wrote:

> Wayne wrote:
>> On 3 Feb 2006 09:03:34 -0800, "comp.lang.php"
>> <phillip.s.powell@gmail.com> wrote:
>>
>>> [PHP]
>>> print_r(is_int('1')); // PRINTS NOTHING
>>> print_r(strlen((int)1)); // PRINTS '1'
>>> [/PHP]
>>>
>>> Now I understand that in PHP, everything scalar is a string
>>
>> *bzzt* wrong. This is where you are getting lost.
>>
>> Everything has a type -- so integers are integers and strings are
>> strings and booleans are booleans. However, PHP will automatically
>> cast scalars to different types as appropriate for a function or
>> operator.
>
> That phrasing is a little confusing...
> integer, float, string and boolean are *all* scalar types. (The only 4
> scalar types supported by PHP.)
>
> Supported types that are not scalar are:
> * the 2 compound types array and object
> * the 2 special types NULL and resource.
>

*bzzt* wrong

PHP references are scalar - but in most instances dereferencing is
transparent and higher precedence than casting.

I believe that resources and NULL are also scalars but not castable.

C.

[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

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