Php Language

This page is intended to be a factual representation of the PHP language. For a discussion about its benefits and shortcomings, please see Php Discussion.

PHP started life as a series of perl scripts for homepages, hence its original name, "Personal Home Pages". It has now grown to be a fully fledged language, with its own advantages and quirks, and as such has been renamed to "Php:Hypertext Preprocessor".

PHP shines most as a server side scripting language, much like ASP/VB/Jscript, or Netscape Server Java Script. However, PHP is also good as a shell scripting language, and you can even write a GUI application with it using PHP-GTK.

PHP is released under a Perl-style license. Essentially, the PHP license gives you the right to use, distribute and modify PHP as much as you want, for both commercial and non-commercial use. You just have to make it clear to the user that what you have distributed contains PHP. You can find out more about the PHP license at download.php.net ( Broken Link )

It is important to note that PHP really has nothing to do with HTML, except that the most common use of PHP is to create dynamic HTML pages - but really, one could make it spit out WML, XML, VRML, plain text, images, or Morse code just as easily. [Interestingly, this occurred to me this spring, when I started using it at my workplace to output Quark Xpress Tags from the command-line to do database publishing. This works really, really well for us.]

PHP has a rosy future ahead of it. It certainly seems to be growing quite quickly. The Zend Engine 2 will fix a lot of the issues in PHP. In fact, the entire OO system is being re-written to be much more OO in style, rather than syntactic sugar (support for things like Private, Public, and Protected methods/fields, interfaces, etc.) Also, the reference issues are going to be fixed; objects will be passed by reference rather than value.

There are also some rather interesting projects on the horizon. Phing is an Ant like implementations for PHP. There is also an application server for PHP titled SRM (ScriptRunningMachine - www.vl-srm.net ), which allows for some object persistence that some people crave.

The core PHP developers have no plans ever to support a static typing system in PHP. (Why make another Java?) However, PHP5 has "Type Hints", which provides optional Strong Typing for Classes.

PHP seems pulled between those who want to make it more Python-like, those who want it more Java-like, and those who want it more Perl-like.


PHP 5

PHP5 has now been released. Rather than being a complete overhaul, it fixes a few quirks of the old OO system; for instance, objects are now passed by reference by default, rather than duplicates being constantly created. The OO implementation looks more like a real OO implementation, and less like only slightly sweet syntactic sugar. There are many new constructs for definition of classes. It has also proven to be highly backward-compatible. What few features have significantly changed are likely to be only in rare use in any case. For those that are interested, a list of changes are available here (www.php.net ). Admittedly the OO implementation looks a lot like Java, for better or worse.

Is PHP4 still useful giving that there is a new Object Model? If so I can get a free ebook from www.apress.com (close to 500 pages) if Iwanna Learn Php.


Critiques keep harping on bad conventions and defaults in Php. Perhaps the industry can create a subset of Php, called something like "Safe-Php" that cleans up these issues. That will get one away from issues of backward compatibility without tossing the good things about Php. New projects would use Safe-Php, and old projects would keep using regular Php.

Hmm. Don't think I like that solution. Wouldn't it be better for the PHP community as a whole to clean up all the old, phunky "conventions" and ass-uptions? Perhaps then we wouldn't see stuff like the PEAR Mail component deprecated new assignment warning, which was supposed to have been crushed back in January 2010 and is still there in October 2010. Oy.

The PHP world is going to continue to see trivial fluff like this as long as old conventions are left hanging around. Rather than split the language into branches and risk the resulting Language Pissing Matches that would ensue (Think Common Lisp and Scheme, for those who even know what that crap is) why don't we just agree to clean up whatever dribblings we come across as we find them?

Face Book have codified their own HipHop-derived branch of PHP as Hack (hacklang.org ) as their more type- and compiler-friendly idea of what PHP should be like (modulo backward compatibility) and a(nother) Virtual Machine (HHVM) to run it on.


PHP is the C of the Internet

C is often used to build base tools and higher-level programming or semi-programming tools (Systems Software). I'm not sure I'd consider that a common characteristic of PHP. I see it more with Java.

: There are lots of CMS and "web apps" made in PHP. If you consider PHP's problem doman to be building web sites, these are base tools and even semi-programming tools.

PHP is the Java of the Internet

I'd argue that Java Script is the Java of the Internet because it's what client-side GUI kits are written in (because there are not many practical alternatives). PHP is perhaps the VB6 of the Internet: relatively easy to start using, but has a messy design behind it that bites you in the caboose for bigger team projects.

Like C

{Actually, Java is the Java of the Internet.}

Recursion is the recursion of the Internet.


See original on c2.com