What am I missing about PHP? [closed]

It’s like this mythical thing that a dominating portion of developers say is just the best option for back-end development, a part of development about which I know virtually nothing beyond the absolute basics.

So I’ve looked up PHP tutorials a bunch of times, trying to figure out why it’s so powerful and common, but it’s annoying as hell– all the tutorials treat you like a new programmer. You know, this is how you make an If Else statement, here’s a for loop, etc. The “Advanced Topics” show you how to make POST and GET statements and whatnot.

But there must be more to it! I don’t get it! That’s practically no different from JavaScript. What am I missing about this language? What else can it do? Where’s the power and versatility? I’ve heard it called a function soup; where are all the functions?

Please chide me. I’m clearly missing something.

6

PHP is terrible. For more information you can check Php a fractal of bad design
I have been working with it close to 13 years now, the last 5 not as a hobby, not even dared to jump deep into its OO capabilities, and I am still finding bugs, gotchas, ahas and plain insane behavior on daily basis.

So if you want to find something unique in PHP that elevates it beyond the other languages – there isn’t. So why it became the alpha dog then:

  • You have no choice – unless you start a project from scratch there is usually something already written in PHP that works. (inertia)

  • It was extremely easy to prototype and iterate – this is more of a historical reason, there are other languages that are good at that now, but c. 1999 there weren’t many of them.

  • Played nice with apache, mysql and was free – maybe the most important thing in this list.

  • Hosting was easy to find

  • Easy database access – there were dark times when there were such things as DAO with wild recordsets out to get you. For a mfc developer the idea that your whole DB layer was mysql_connect, mysql_query with simple sql was a godsend.

  • Simple tool for a simple task – php is really good at getting data from a DB and putting it in a punched hole in your html. And at the dawn of time that was website development.

14

The big reason for PHP’s popularity can also be attributed to its ease of use. Anyone (quite literally) can program simple PHP after checking out a few examples of code and trying it a few times. Other web programming languages require a whole lot more effort to create even the simplest of programs, and barring C and Java, there’s not much in the way of online examples. Most people don’t want to install humongous IDEs, build a dedicated web server, and arrange for a DNS, when all they want is to spice up their website with some extra features. Perhaps they have heard enough horror stories about Javascript that they want to use something else.

In comes PHP. No IDE required, just any regular text editor that comes pre-installed in pretty much all computers. Then just upload a couple of files to a web host, maybe adjust permissions for a few files, and that’s it. Fire and forget, if you please. Certainly not pretty or elegant, but it works and is quick. Testing is just pressing F5, without any compiling, delivering, and deploying.

For something more elaborate, just a quick install of WAMP/LAMP, and change a couple of settings in a text file, and off you go in the comfort of your home computer in an environment that is almost “real”, so you can easily see the changes on the fly.

I highlighted a few points which I feel are the biggest reason for PHP’s popularity.

Check out http://www.php.net/manual/en/

It’s tough to really list all the things you can do with server-side code over client-side code, although if someone else made such a list I would find it really interesting. It’s certainly very easy to think of things that you should do on the server-side, since on the client side anyone can read and modify your code.

4

I think the main advantage of PHP, at this stage of the game, is the huge collection of frameworks, libraries, utilities, templating engines and extensions, all designed around server-side internet applications. Similar to how Java had, for years, a very wide ecosystem of tools that made it more interesting than C#, for instance, despite the fact that the language itself wasn’t as good as C# (IMO).

It’s a bit of a chicken-and-egg situation, since the value of PHP is in its popularity, how did it get so popular? Well, that’s a combination of factors, including low barrier of entry (like VB in the 90’s) due to being very flexible about the code it accepts, no matter how ugly, and a lack of language that were really web-app driven when it started.

The language itself is not very exciting, the functions are “grown organically”, you probably have heard of the inconsistencies in parameter order.

The power for backend development comes in when you don’t do everything yourself but use one of the existing (PHP 5.3) frameworks. I recommend Symfony 2, but also have a look at Zend Framework, CodeIgniter and CakePHP to see if their framework style fits with your programming style. You’ll get foundational stuff like session handling, caching, authentication, separation of data, presentation and action layer (MVC), etc.

A number of reasons:-

  • Shallow learning curve. Its easy for beginners to write a simple working web site.
  • Pricing. Its really free as in beer.
  • Freedom. Its truly open source, this encourges a large development community.
  • Packaging. The projects such as XAMP provide a complete working web server and development environment will all the libraries, databases and tools most developers will ever need.
  • While there are features that annoy CS graduates the language is actually pretty nice to work with.
  • Focus. The language developers, the library integrators, almost everybody involved in what is a very, very large development community has a single focus — build a working web application with the least effort.
  • Documentation. The documentation/wiki on the PHP web site is probably the best example of how to do on-line documentation. Well organized, searchable and full of user provided samples and hints.

8

You mentioned “That’s practically no different from JavaScript”. Certainly allot of common languages like C/C++/C#/Python share similar syntax.

However the bigger difference compared to say Javascript is that it’s most commonly used on the server side hence you can interact with a database, create an authentication system, manipulate images etc.

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật