News for hackers. Stuff that matters.
Re:PHP needs to die. What will replace it? by jlgbecom on Monday September 27, 2010 @03:59PM (#1733124)
I've been using PHP professionally since it was called PHP/FI, and while it's a terribly designed language, I've longed stopped hating it. I know all of it's quirks, and I know all of it's work arounds, and the density of support it has can't be beat.

I wouldn't complain if a better server-side language came around (not a big fan of Ruby's syntax, but Google's Go looks enticing), but until then, I've built incredibly complex apps in PHP, and rarely do I run into a limitation of the language. My biggest issue in the past was the lack of namespaces, and 5.3 has those.

I think the best thing you could do to get a new language as popular as PHP isn't to evangelize, or even to make the language dead simple, but make it dead simple for administrators to add support to a typical shared hosting environment.

Re:PHP needs to die. What will replace it? by seldo on Monday September 27, 2010 @04:03PM (#1733146)
PHP's amenability to shared hosting environments is an advantage I failed to mention.

I'm pretty much in the same place as you with regards to PHP: I know it like the back of my hand and everything and everybody works with it. But the code is ugly compared to other languages and I really want method chaining, dammit. Plus, of course, I don't want to have to write an MVC framework every time I want to do something.

Re:PHP needs to die. What will replace it? by jlgbecom on Monday September 27, 2010 @04:05PM (#1733156)
Unless you're being more specific than I think you are, PHP5 has basic support for method chaining, I use it all the time.
Re:PHP needs to die. What will replace it? by byoung2 on Monday September 27, 2010 @04:33PM (#1733288)
I use structures like this in PHP5 all the time:

  $object->doThis()->doThat()->doTheOther();
But maybe he is referring to method chaining using PHP's built-in functions. There isn't a way that I'm aware of to do the following (short of wrapping the built-in functions with your own classes):

  $string->preg_replace("/[^A-Za-z]+/","_")->trim()->upper();
Re:PHP needs to die. What will replace it? by seldo on Monday September 27, 2010 @05:13PM (#1733443)
Precisely what I meant, thanks for clarifying.
Re:PHP needs to die. What will replace it? by BerislavLopac on Wednesday September 29, 2010 @06:20PM (#1741368)
But this is not method chaining, that's simple function nesting, and can easily be done as:

$string = preg_replace("/[^A-Za-z]+/","_", trim(upper($string)));

Or am I missing your point?

Re:PHP needs to die. What will replace it? by jhaglund on Monday September 27, 2010 @04:27PM (#1733249)
Re: MVC re-writing. I settled on Zend Framework and havn't looked back. http://framework.zend.com/ (link added)
Re:PHP needs to die. What will replace it? by jawngee on Monday September 27, 2010 @04:34PM (#1733291)
> I really want method chaining, dammit

What? We've been doing code like:

    filter('user')
        ->first_name->like('bob')
        ->age->equals('22')
        ->order_by->created->desc
        ->find();
Since 5.2.x
Re:PHP needs to die. What will replace it? by auxbuss on Monday September 27, 2010 @07:13PM (#1733893)
Method-chaining has been there for a while.

I keep happening upon projects with their own craptacular homebrew MVC framework, and their own abysmal homebrew caching.

Fix is a swap for yii and memcached -- feel free to choose your faves.

Re:PHP needs to die. What will replace it? by bl4k on Monday September 27, 2010 @04:10PM (#1733183)
something tells me you don't know what method chaining is
Re:PHP needs to die. What will replace it? by dflock on Tuesday September 28, 2010 @03:39AM (#1734905)
Yeah, any replacement will need to be _everywhere_. No-one talks about PHP deployment issues, because it's literally everywhere. You have to build your own server if you want one _without_ php. That's it's killer feature.
Re:PHP needs to die. What will replace it? by omouse on Monday September 27, 2010 @08:28PM (#1734117)
while it's a terribly designed language, I've longed stopped hating it. I know all of it's quirks, and I know all of it's work arounds, and the density of support it has can't be beat.

Stockholm Syndrome?

Re:PHP needs to die. What will replace it? by jlgbecom on Monday September 27, 2010 @09:32PM (#1734258)
Oh yeah, it's totally like being violently threatened and abused by terrorists. That's a perfectly reasonable analogy.

Seriously, when you've been programming long enough, you really stop caring about programming languages. I could build a huge project in VB.Net or ColdFusion if I had to at this point. If there's good reasons for why a language should be used (and PHP has plenty of them that are external to the language itself), then it's immaterial to me.

Re:PHP needs to die. What will replace it? by petervandijck on Monday September 27, 2010 @04:30PM (#1733270)
5.3 has namespaces? Awesome :)
Re:PHP needs to die. What will replace it? by jlgbecom on Monday September 27, 2010 @04:37PM (#1733304)
Yes, but in true PHP fashion they're just slightly ugly. :)

namespace my\name;

$c = new \my\name\MyClass;

Re:PHP needs to die. What will replace it? by mahmud on Monday September 27, 2010 @05:13PM (#1733445)
Leave it to PHP to look up to MS-DOS for inspiration.
Re:PHP needs to die. What will replace it? by mrj on Monday September 27, 2010 @05:22PM (#1733486)
Ug. I thought you were joking. Now I'm sad for humanity.
Re:PHP needs to die. What will replace it? by petervandijck on Wednesday October 20, 2010 @09:31AM (#1811102)
Ugly but functional, that's good enough for me :)