You are here: Re: Very Weird Behavior « PHP Programming Language « IT news, forums, messages
Re: Very Weird Behavior

Posted by Alan Little on 11/28/05 18:30

Carved in mystic runes upon the very living rock, the last words of Ian
B of comp.lang.php make plain:

> Alan Little wrote:
>>
>> Perhaps, but it has no bearing on the issue. That is, if I used
>> isset() instead, perhaps it wouldn't tickle this particular bug, but
>> it is in fact a bug. Which reminds me, I should report it.
>
> It's not a bug, it's illegal code. You can't terminate a line with a
> dot,

Sure you can, unless you mean you can't terminate a statement with a
dot. Nothing wrong with terminating a line with a dot, if your intention
to to concatenate whatever's on the next line.

> and you can't concatenate an if statement into a string.

Of course. As mentioned originally, I inserted the if's, and forgot the
change the appropriate dots to semicolons.

> It produces a parse error and stops execution.

It does neither. No error, and execution resumes in the main code (this
was in an included file).

> If you don't get an error message it is because of your settings.

error_reporting = E_ALL

>> > What do you expect from if($varname) ?
>>
>> I expect PHP to tell me if it has a problem. While if ($var) may not
>> be ideal coding practice, it is legal.
>
> Legal, yes. Useful in this situation, no. What you are saying in
> effect is "if the website name can be converted to a non-zero number,
> then..."

I understand. And it is useful in this situation. It basically is a
shortcut of if(strlen(trim($Website)))

> I don't mean to give offence,

None taken.

> you should consider coding like other people do, at least until
> you understand the consequences of not doing so.

Well, I do understand exactly what the code is doing, but to be honest I
don't believe I've heard all the arguments against using it; I just know
there are some.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

 

Navigation:

[Reply to this 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

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