Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
PHP Programming Upgrades

The New PHP 254

An anonymous reader writes "This article at O'Reilly Programming suggests that PHP, a language known as much for its weaknesses as its strengths, has made steady progress over the past few years in fixing its problems. From the article: 'A few years ago, PHP had several large frameworks (e.g. CakePHP, CodeIgniter, and so on). Each framework was an island and provided its own implementation of features commonly found in other frameworks. Unfortunately, these insular implementations were likely not compatible with each other and forced developers to lock themselves in with a specific framework for a given project. Today the story is different. The new PHP community uses package management and component libraries to mix and match the best available tools. ... There are also exciting things happening with PHP under the hood, too. The PHP Zend Engine recently introduced memory usage optimizations. The memory usage in PHP 5.5 is far less than earlier versions.'"
This discussion has been archived. No new comments can be posted.

The New PHP

Comments Filter:
  • by LF11 ( 18760 ) on Tuesday March 04, 2014 @08:09PM (#46403255) Homepage
    Wake me up when they implement namespaces correctly. With a syntax that doesn't look like Satan's diverticulitis.

    It is nice to see that PHP is starting to grow up a little bit. They have long way to go.
    • Wake me when they decide to not care if it breaks existing php implementations and do some real clean up on the language. They keep adding features to the language and don't remove any of the garbage.
      • by lucm ( 889690 )

        Wake up time. PHP actually has a pretty decent way to remove "garbage". First they make the compiler (and documentation) warn you about a feature being made obsolete in a future version, and then a few versions later they do remove the feature.

        Here is an example (quote from the manual [php.net]):

        As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);. And as of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal

      • Wake me when they decide to not care if it breaks existing php implementations and do some real clean up on the language.

        Every time you break existing applications, you create systms that are stuck with old and buggy versions. That's bad enough normally, but is a terrible idea in a language meant for writing Internet-facing apps. Dealing with detritus is preferable to burning down the house to get rid of it.

  • Have they managed to keep from breaking crypt() recently?

  • Perl vs PHP (Score:4, Interesting)

    by Camel Pilot ( 78781 ) on Tuesday March 04, 2014 @08:29PM (#46403445) Homepage Journal

    Being long in the tooth I do all my web development via Perl using my own nice call back templating engine and of course CGI.pm. Nice separation of code and html -neither of the two find themselves in the same file. Once in a while I have to do some repair work for customers in PHP and in horror find the html and code mixed to together with wild abandon and massive uses of global variable and I wonder PHP is so darn popular.

    • I've found that using the Smarty [wikipedia.org] template enginr helps me avoid that situation in PHP and the learning curve is fairly shallow.

    • by jrumney ( 197329 )

      Being long in the tooth I do all my web development via Perl using my own nice call back templating engine and of course CGI.pm.

      Having seen some Perl web scripts that very much do not meet this description, and some PHP that was nicely templated I can say with confidence that it is not the language that is at fault here.

    • Wow - I'm not sure you should be using the sample of bad existing code as an argument against PHP and FOR perl. Yikes.

  • by MarkRose ( 820682 ) on Tuesday March 04, 2014 @08:37PM (#46403533) Homepage

    Many of the problems with PHP are from the crappy language implementation. I recently came across a Java implementation of the language. It's been around forever, but as I hadn't heard of it, I figure many people reading this thread haven't either. It's Quercus [caucho.com]. It's certainly worth a look as a Zend alternative.

    • > Many of the problems with PHP are from the crappy language implementation.

      Yes, because switching to a subtly different language implementation is not going to cause any problems running code that was written for the standard PHP implementation.

      > It's Quercus [caucho.com]. It's certainly worth a look as a Zend alternative.

      That was release 7 years ago. No one appears to really use it.

      Do you really think that if it was such a great improvement over the Zend engine that people wouldn't be using it?

  • Still waiting (Score:4, Interesting)

    by Ziest ( 143204 ) on Tuesday March 04, 2014 @08:45PM (#46403629) Homepage

    I'm still waiting for PHP to be completely case sensitive, a sane scoping scheme and real object oriented (can you say polymorphism)

  • The beautiful thing is their lovely page explaining that it wasn't an insecure design, just one which "could be misused".

    I'd say that a feature that easy to "misuse" in ways that lead to security holes is, in fact, a pretty good example of an "insecure design".

  • by Anonymous Coward on Tuesday March 04, 2014 @08:52PM (#46403705)

    I don't normally like linking to blog posts, but this one pretty much sums up PHP for me:

    http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

    His analogy is very apt.

  • Moving to Python (Score:5, Informative)

    by EmperorOfCanada ( 1332175 ) on Tuesday March 04, 2014 @10:06PM (#46404311)
    I have build some very large PHP based web systems(over the last 10 years) and recently dipped my toes into the Python pond. My python skills might be a tiny fraction of my PHP or C++ skills and I doubt that I am using Python anywhere near its potential, yet my productivity is already much higher and getting faster. I am waiting for there to be a catch but so far I haven't found one.

    It is shaping up to be one of these things where my only regret is not switching sooner.

    I was a huge defender of PHP for a long time but that time is over. There are interesting things like HHVM that are another bandaid for PHP but I am sick of making PHP work. I am sick of typing all those stupid dollar signs. I'll just say what so many have said before, "Python is like typing pseudo code, except you are actually coding." I don't look at my python and shudder.

    PHP reminds me of some of my own projects where I changed course many times leaving strange little architectures and changes in philosophy. The longer the project goes on and the more it changes direction the more debris it leaves behind. It is not necessarily broken just sort of all just off.

    Where Python is a tiny problem with the web is that setting up a development environment took me a tiny bit more work than the usual LAMP setup. This might make it harder for beginners but maybe that is a good thing. I don't mind leaving the beginners back in PHP land.
  • PHP's biggest problem is lack of modularization and encouragement of inline script hacking. It suffers from SQL that lacks proper commit controls. Implementations I've used leak connections like a seive, forcing restarts of the database servers on a regular basis.

    Bottom line: PHP is the one tool I've used that I hate more than JavaScript. JS is functional elegance compared to PHP spaghetti.

    • > It suffers from SQL that lacks proper commit controls.

      Wat?

      > Implementations I've used leak connections like a seive, forcing restarts of the database servers on a regular basis.

      While that must have been frustrating for you - that's not a common complaint, so was probably specific to either your DB or configuration.

      > PHP's biggest problem is lack of modularization and encouragement of inline script hacking.

      You mean you suck at writing decent code, without being forced to do things 'properly' ?

      • by msobkow ( 48369 )

        No, it means people keep demanding that I work on PHP I didn't create and it's all steaming piles of SHIT.

        Like PERL, you can create maintainable and readable PHP. Most people don't. They hack something together thinking they'll need it for a month and be done with it, and the steaming turd keeps on in production for years afterwards.

        And then some poor fellow like yours truly is expected to enhance the god damned thing which has no comments, uses perverse libraries that no one else uses and which have

        • by msobkow ( 48369 )

          My response to those demands nowadays?

          "Yes, I know PHP. That's why I won't work with it. You couldn't pay me enough to take on a PHP project."

    • Implementations I've used leak connections like a seive, forcing restarts of the database servers on a regular basis.

      The only time I've seen this was when a "Java Expert" built out a platform using PHP, and tried to make it jump through hoops to work like Java. Net result? Factory factory factories (not exaggerating) that resulted to an amazing kludge of massive memory-hogging threads which brought the servers down on a 2-3 hour cycle. Took massive refactoring to clean up that mess.

      A scripted language funda

      • by msobkow ( 48369 )

        The fellow who wrote the original code used a library I'd never heard of for MySQL connectivity. They didn't know how to use SQL properly. They didn't know how to error check results. Hell, they didn't even know how to sort data for the users as they'd been asking him to for months before.

        But no, he left the company and the steaming pile of crud was dropped in my lap to fix.

        By the time I was done stabilizing the thing, there must have been a whole 10% of the original code left.

        Just because it's po

  • by Qbertino ( 265505 ) <moiraNO@SPAMmodparlor.com> on Wednesday March 05, 2014 @07:14AM (#46406585)

    I love Python, I think JavaScript is sort of OK and I did a lot of serious programming in ActionScript 2&3, both of which are quite simular to JS. I was basically forced into doing PHP by the market. I never really liked PHP but I really never hated it either. The thing about PHP is that it's so specific in its domain and such a hack that no one doing PHP development for a living will go around boasting about the greatness of the language. There is a refreshing lack of arrogance in the PHP community which, in my observation, makes it very easy for n00bs to pick up. As a result we get countless people reinventing the wheel in PHP and discovering basic programming patters anew for them selves and starting yet another Framework/CMS/Whatnot and the results often are really bizar. But the community remains alive that way.

    F.I. I'm working myself into Drupal at my current employer because it's the prime go-to CMS here. It's like a live alice in wonderland trip. A strange historically grown mess, barely tamed by sanitiy and a relentless chaotic community that all by accident seem to come up with hacks that somehow solve the problem in some way. And yet there's a solid global corporation building its business all around Drupal [acquia.com]. The surreal hacks with which the Drupal people solve their problems are mindboggling, and yet everybody seems totally OK with it. And Drupals track record of deployments is impressive.

    I guess with PHP it's somehow like the C vs. Lisp argument: C is so shitty compared to Lisp that you have to get yourself together and work as a team, or you won't get anything done. Hence Lisp has this loner exisitance on the side and all the real work gets done in this ancient C thing.

    PHP is a simular thing. It is so bad that no respectable programmer would pick it up voluntarly nowadays, but yet it grew out of Perl (which is worse in some ways), was somewhat of an improvement and was at the right place at the right time. The badness of PHP accounts for its considerable lack of arrogance (compare the PHP community to the Ruby community for instance) and for no one feeling guilty when he does a quick bad hack.

    As a programmer you don't feel dirty when you do bad programming in PHP, you already felt that when you picked PHP as the solution. Hence quite a bit of work gets done in PHP. That's why PHP has Drupal and Typo3 and Joomla and the Java Community has nothing of that proportions. The barrier of entry into PHP is *very* low which gives it its momentum.

    My 2 cents.

I tell them to turn to the study of mathematics, for it is only there that they might escape the lusts of the flesh. -- Thomas Mann, "The Magic Mountain"

Working...