3 ms·
I've been working with PHP since 1996 and rarely see eval being used. I've worked with hundreds of companies training PHP developers, seen inside (and written)
by mgkimsal 14y ago
I've been working with PHP since 1996 and rarely see eval being used. I've worked with hundreds of companies training PHP developers, seen inside (and written) some very large codebases handling millions of dollars of transactions, and don't recall seeing eval in any of them.
"it was easy to see why PHP got big"
It's easy to see why it's staying big:
1. cheap shared hosting to get started
2. most hosts offer one-click installation of any sort of application people need on the web (blogs, shopping carts, calendars, social networking, file hosting, etc)
3. 15+ years of knowledge about what works and what doesn't when attempting to scale PHP to large needs.
4. ubiquity which keeps a large pool of reasonably priced talent available, which perpetuates the cycle.
When there's a competitive language that can be placed in a directory as FOO.abc, I can hit it as /FOO.abc and have it execute, with html content type sent by default, it'll have a running jump at dethroning PHP.
The barrier to entry is the lowest out there, but the heights it can scale to are facebook-level and beyond.
- chaostheory 14y ago> I've been working with PHP since 1996 and rarely see eval being used. For some reason most of the major frameworks use it, hence their incompatibility with hiphop; then again I could be wrong. > 1. cheap shared hosting to get started One can argue that all of the major languages have access to this. PHP doesn't have an edge in this area. > 2. most hosts offer one-click installation of any sort of application people need on the web (blogs, shopping carts, calendars, social networking, file hosting, etc) With the rise of the cloud hosts and automated config, as well as more automated tools available (e.g. Chef, Puppet), this is a temporary advantage. Deploying on Linode and Heroku and (insert cloud host company) are getting easier and easier. > 3. 15+ years of knowledge about what works and what doesn't when attempting to scale PHP to large needs. No argument here. My points only apply for people starting now, and not for PHP vets. > 4. ubiquity which keeps a large pool of reasonably priced talent available, which perpetuates the cycle. No argument here either. My points were being made for individual programmers who are just starting out, and not for companies. Even from the point of a company though, PHP's current lack of flexibility lowers the chance of innovation imo. The other dynamic languages are just as easy to learn and they just offer more than PHP does.
- mgkimsal 14y ago>No argument here. My points only apply for people starting now, and not for PHP vets. I wasn't meaning for people - I meant 'the industry' as a whole (or a large segment) - standing on the shoulders of giants and all that. >> 1. cheap shared hosting to get started >One can argue that all of the major languages have access to this. PHP doesn't have an edge in this area. Really? I think there's far more options for people with 'PHP' in the hosting arena. It's not that you can't use other languages/platforms, but ... competition for hosting basic PHP stuff is massive - not so much for Ruby/Rails, Python, etc. along with all the extra stuff you'd need (community libraries and such) - much more is baked in to PHP hosting than you get with the majority of other platforms. Java in particular is expensive to host anything useful because it's RAM hungry. re: eval - do you have pointers to examples? I just grepped Zend Framework 1.10, and there was 1 eval, in Serializer/Adapter/PhpCode.php, with a warning that it shouldn't be used.
- chaostheory 14y ago> I wasn't meaning for people - I meant 'the industry' as a whole (or a large segment) - standing on the shoulders of giants and all that. Ruby and Python aren't very new. There are giants there as well. If you're going to make that argument, then Java has a bigger advantage. > I think there's far more options for people with 'PHP' in the hosting arena. As I've already said, I don't disagree. I just said that this advantage is going away. Personally I'd also rather go for host that's mid-ranged as opposed to hosts that are in the race to the bottom. I don't think paying $10 more a month is exorbitant especially if it buys you a lot of language power and it takes over more sysadmin duties from you. > re: eval - do you have pointers to examples? Every major PHP framework uses it. How do I know? To my knowledge you can't use any of them with Facebook's hiphop out of the box. I suspect this is one of the main reason's no one uses hiphop even though it gives you a good deal of performance gains for PHP.
- mgkimsal 14y ago"Every major PHP framework uses it. How do I know? To my knowledge you can't use any of them with Facebook's hiphop out of the box. I suspect this is one of the main reason's no one uses hiphop even though it gives you a good deal of performance gains for PHP." Zend Framework 1.10 - a fairly high-profile framework - has 1 instance of eval in a component I've never known anyone to use. I suspect hiphop has a few other issues with it, but... even more to the point, I don't think most people think they need hiphop. It's an unknown - it's a compilation step, and adds a couple extra steps of complexity. People can get a lot of performance gains by using Zend Server caching or APC with far less unknowns vs digging in to hiphop. Additionally, hiphop has had some issues with postgres/pdo, closures, imap and more PHP stuff over the last year or so. It's a nice thing from facebook, but it was written for their own problems, not as a general use tool for everyone. If it can evolve in that direction, the adoption may go up. Until then there's far more well-tested ways to improve your performance of PHP.