Reply to Re: Code readability vs. execution time

Your name:

Reply:


Posted by Steve on 09/04/07 16:31

> $int="0"
>
> If($int==0) echo "true";
> if($int) echo "its non zero"
>
> I am still not sure WHAT that last statement means, 0 means unsassigned,
> non zero, or what...
>
> At least in C you could be sure it meant 'the numerical value of whatever
> $int is supposed to be, when cast to an integer, is tested for zero)

just remember that php is NOT c...and that your 'if ($var)' is covered in
the manual in depth *and* occassions where === are required. btw, nothing
prohibits you from type casting or checking in php.

> And I used to LIKE my compilers giving me hell about
>
> foo{return ('c');}
>
> char p=foo();
>
> and making me type it either as
>
> char foo{return ('c');}
>
> or char p=(char)foo();
>
> Fussy, but it did pick up some errors all right.

so cast it or check it. whatever the case is, i love having the ability to
return a specific type of result when things go well inside a function call
but returning 'false' if things weren't agreeable. as for c, the function
would either have to take a byref arg for the return data and check for
true/false as the function's return...or vice-versa...i hated that construct
but understood that it had to be that way to retain typing. i love php for
its many facets of flexibility including the above.

but, maybe that's just me.

[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

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