

PHP Dark Arts: Sockets - vital101
http://www.re-cycledair.com/php-dark-arts-sockets

======
spooneybarger
I don't mean to be snide, but in what universe is basic socket programming
considered a 'dark art'? Has programming as a whole really fallen that far?
Socket programming isn't deep or complicated, it is pretty straightforward and
most anyone with a vaguely decent amount of programming experience ( 1 year at
most from my experience ) should be able to pick up the basic right away.

~~~
InclinedPlane
a: it's in PHP

b: the overall skill level of programmers ranges across several orders of
magnitude, amongst the group of folks who are "programmers" or software
engineers by job description only a small fraction of them are capable of
socket programming without getting well in over their head quickly.

~~~
spooneybarger
If b is true then I've apparently lead a sheltered life. Every programmer I've
worked with, even the ones I could call 'not so good' where able to do socket
programming.

------
bhiggins
PHP Dark Arts: doing something beyond <p>hi there <?php echo $username ?></p>

~~~
petervandijck
I know I'll get flamed for this, but that's actually beautifully elegant.

~~~
pornel
and insecure. Correct version is:

    
    
      <?php echo htmlspecialchars($username); ?>

~~~
petervandijck
That's so incorrect I don't even know where to start.

~~~
pornel
I'd like to hear what's incorrect about it.

Do you think values should be escaped before output? Or that usernames don't
include chars that need escaping in HTML? Or perhaps you'd add extra filtering
to ensure that page cannot become ill-formed due to encoding error? Or perhaps
it's incorrect to use PHP at all? ;)

