[clue-tech] I'm blind, or why is this PHP fwrite() failing?

Jed S. Baer thag at frii.com
Sun Sep 25 22:52:41 MDT 2005


On Sun, 25 Sep 2005 22:18:43 -0600
David L. Anselmi wrote:

> It's no surprise to me to have multiple values for truth or untruth. 
> But to be able to return a boolean or an int at will and have the int 
> cast to a boolean seems to be rather more surprise than less.  Imagine 
> yourself trying to debug that one--shouldn't a language help you avoid 
> those kinds of mistakes?

Well, the answer is contained further in that page, where a commenter
distinguishes between the bitwise || operator and the "or" operator. I
don't write enough PHP to keep that subtlety in my head. And, IIRC, my
cranial computer mostly evaluates the two as equivalent, based on a set of
rules which I don't even remember any longer. I'd have to check, but I
think in PDP assembly language, "logical" OR was simply the evaluation of
a bitwise or to see if any bits were set, or was it if any bits were off?
Doesn't matter, really, except that when different languages treat a cast
to BOOLEAN differently, it can trip up a multi-lingual programmer.

Using the "or" operator instead of "||" fixed my original code.

> I'm no programing wizard, nor language guru.  And I understand the lure 
> of being able to build web apps quick and easy.  But if they wanted a 
> web app framework couldn't they have adapted an interpreter for a tried 
> and true language?  And you can build web apps in Java, Perl, and Python
> (oh, and lisp too).  I don't understand what people find compelling 
> about PHP--what did everyone else do wrong?

I don't think it's that everyone else did anything wrong. It's just that
it is quite easy to get dynamic sites up using PHP. I think part of the
appeal is the (at least in the beginning) automatic assignment of GET and
POST variables to program variables of the same name as the CGI name/value
assignments. Makes form work much easier than what Perl supplied. I can
recall doing simple forms in Perl, and that wasn't part of the language.
There were, of course, lots of add-on packages and form processing wrapper
code packages to ease the handling, but it still wasn't as easy as PHP.
So, PHP, I think, became the "entry language" of choice for quick web
development. I've seen lots of code, BTW, written in PHP by supposedly
experience PHP coders, who obviously, from reading their code, weren't
really savvy programmers.

And, uh, PHP started out as a Perl package, didn't it?

My very first CGI script was written in korn shell, BTW. ;)

jed

-- 
http://s88369986.onlinehome.us/freedomsight/
Key fingerprint = B027 FEFB 4281 CC72 67D1  4237 F2D0 D356 077A A30E
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list