Reply to Re: Is PHP more tolerant of errors?

Your name:

Reply:


Posted by NC on 12/18/05 22:26

Curtis wrote:
>
> One surprise is PHP's apparent tolerance of referencing
> array elements that don't exist. Object Pascal would burp
> in a hurry.
>
> Say I go
>
> $parts = explode("|", "x | y | z");
>
> PHP doesn't seem to mind if I tell it
>
> $text = $parts[3].$parts[4];

First of all, in a situation like this, PHP would issue a warning,
unless error reporting is turned off. Second, nothing prevents you
from checking whether a particular variable exists using isset() or
array_key_exists(). Third, if you reference a non-existent variable,
the result is predictable -- a NULL.

Cheers,
NC

[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

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