TravisSwicegood.com

6 April

PHP's Problem

How's that for a loaded title? ;-) First off, let me state that I am by no means a PHP hater. I've actually made quite a good living off of it, and unlike some people in other languages, I've never ended up on the streets homeless cause of PHP (yet).

I made a comment on Twitter about DHH's PHP post.

@chartjes that's sort of a backhanded comment, but it's dead on... PHP is ok until you start getting big, then it generally gets ugly

He took that as a bash and decided to challenge me to a dual. We nominated seconds, planned to cross the river into New Jersey, then realized that Twitter without loaded pistols would probably be a much better solution. And that's how the world's first twebate was born.

My final tweet on the debate I think sums up my view of PHP right now:

[PHP]'s like that super smart slacker we all knew in HS. If it would just apply itself, it could be really great.

I'm not exactly sure what it needs to do to "apply itself" as a language. It could start by realizing "because we've always done it that way" isn't a good reason not to change broken behavior. That's what compatibility modes are for. It could also look to Python to see how everything as an object can be liberating unlike Java where it can hinder you. It could realize that extensions are the next obvious step for anyone trying to make PHP hum and make the command to load a function/module—whether it's parsed or compiled—the same.

Every time I see a mysql_real_escape_string(), have to look up to see whether the string function I'm using has an underscore or not between str and what it does, or have to read a manual entry to figure out if my array function modifies the array I pass it or returns a new one I sigh and can't help but be reminded by that anti-social kid in the back of the class, drawing furiously in his notebook. He was a genius, he just needed some encouragement and the guts to grow up.

5 comments

"PHP is ok until you start getting big, then it generally gets ugly"

I agree , but PHP frameworks would save you from getting ugly.
really +1 on your last period.
Function underscores and by-reference by-value array function should be made homogeneus. Old versions should be only made compatible for a while. Seems so easy to do.
@Kinch - I've yet to see a framework that scales well (in terms of performance and scalability) yet still provides the flexibility necessary for many large applications and still manages to stay clean. There has yet to be on architected in PHP. I'm not saying Rails of Django or Spring are any better, but all the current crop of PHP frameworks do is keep you from having to rewrite a DAO by their half-assed attempt to copy Rails' broken Active Record implementation.

@Gabriele - Check the PHP source code for the few functions that have had that happen. An alias is literally a matter of adding another function reference to the internal implementation, whatever it is named. It's not a matter of easy to do, it's a matter of trivial.
hi,i have a problem.
i have 2 hosts:
(myown host)host B --> page a.php
(other host)host A --> page b.php.
i want session id page on host A.
but i just access host B.
i used this on a.php page on host A:

it shows myown b.php page included a.php ,on host A.
i want get session id of a.page on host A.
i want code like session_id("www.hostB.com/b.php");
how can i get session ID of another website?

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)