Reply to Re: [PHP] function with argument of type array

Your name:

Reply:


Posted by Marcus Bointon on 07/29/05 10:37

On 29 Jul 2005, at 08:19, Jochem Maas wrote:

> unless String is a class you defined that won't work at all. basic
> data types
> cannot be hinted (e.g. bool, int, string, float)

There's been quite a bit about this on php-internals. It seems to be
because PHP doesn't differentiate between these types internally;
they all seem to be classified as a generic scalar type whose actual
type is determined according to context. Java can go to the other
extreme, where every simple type is an object, and hence it's easy
(if not mandatory) to specify types like this. You would never be
able to say 'print "2" + 2' in Java and expect to get "4". This
looseness is very much part of what makes PHP so easy to get into -
if you really want these kind of features, you can just use Java
instead!

Another point is that exception handling (another PHP5 feature) is
next to useless without type hinting, so they HAD to implement it for
objects so that catch clauses could work properly.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

[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

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