PHP5 Just Around the Corner
HitByASquirrel writes "Just doing the rounds and I found that Zend has released PHP 5.0 Beta 4: 'This fourth beta of PHP 5 is also scheduled to be the last one (barring unexpected surprises, that did occur with beta 3). This beta incorporates dozens of bug fixes since Beta 3, rewritten exceptions support, improved interfaces support, new experimental SOAP support, as well as lots of other improvements, some of which are documented in the ChangeLog.' Hopefully they won't have any 'unexpected surprises' and we'll see this before summer!"
... wake me up when PHP 5 final is ready.
Recently I've had a chance to do some web design with PHP. Previously I'd used Pearl because I'd heard from many people that Pearl was the end all and be all of scripting languages for the web. Imagine my suprise to discover that PHP was vastly superior! I know this is a bold statement, but I have solid arguements to support it.
Before I begin, let me just clarify something. I'm not arguing that PHP is better than Pearl in all cases. There is certainly still a use for Pearl. Also, PHP isn't perfect but it does manage to fix many of the shortcomings I've had with Pearl. Here are a few of the things I've noticed about PHP. Finally, I'm not the most talented Pearl programmer out there. I generally prefer to use the vastly superior Phyton, but can use Pearl if I have to.
- Ease of use. After about a day I had an excellent understanding of both PHP and SQL. I was able to get a stable, useable and presentable website up within 24 hours of reading the basics of PHP. Learning Pearl took me weeks and I'm still not even as good with it as I am with PHP. I would definitely not recommend anyone new to programming begin with Pearl.
- The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Pearl's OO still needs work (whether or not OO is all that great is another discussion.) Hopefully Pearl will be patched up so it supports such must-have OO features like introspection, reflection, self-replication and ontological data-points.
- Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Pearl seems limited to MySQL and PostgreSQL, and its really a kludge for the later. I've heard that this will be fixed in upcoming versions of Pearl though.
- Speed. PHP is one of the fastest languages I've ever used. While it won't be replacing assembly or C, its definitely faster than Pearl in almost every case, particularly in regex which has long been Pearl's strongest point. I'm sure there are cases where Pearl is equal to PHP, but I can't think of any at the moment.
- Portability. I can take PHP code off my Linux box and plop it onto an IIS server, or even one of those new McIntosh servers and have it run without having to change a single line of code. Try doing this with Pearl! Its as though it was written in assembly, Pearl requires that much rewriting.
- Graphics. PHP comes with a nice little graphics library. While I wouldn't use its to code the new Doom (VB would be a better choice) its adequate for most web pages, and should be considered as a substitute for Flash for certain things. Pearl lacks a graphics library of any kind.
- Data Structures. Under PHP you can create any type of datastructure you need: Linked lists, binary trees, hash tables, queues, inverse Reiser-biased recursion trees, etc. Under Pearl you're extremely limited in what you can do. This is because Pearl isn't OO (so you can't create Node classes, for example, usefull in a linked list) and because it lacks pointers. Some of you may notice that PHP lacks pointers, but look deeper! Behind the scenes, hidden from the user pointers are used. Because of this, PHP can support complex data structures.
Again this is just my experience. I don't mean to offend any Pearl coders because Pearl was an excellent language. However, in certain cases it may behoove one to write the back end in PHP instead of Pearl.forgive the ingnorance guvnah, but what were the unexpected surprises from Beta 3?
The much-requested feature of Upload progress did not make in PHP5.0
Too bad. Now we need to wait until PHP5.1 or something.
And meanwhile stick with PHP sourcecode patch or perl method which is nightmare.
Does every little scripting language have to repeat the same mistakes? Lisp 1.5 thought it could get by without. Perl did. Python did. Lua did. In the end, they all added them.
Come on, guys, learn something from history, avoid making the same mistakes over and over again, and add lexical closures to PHP.
Are they rewriting the docs to actually explain the features of the language
and how to use them? I tried to learn PHP, but I got really tired of reading
about how much "better" PHP is than Perl because it's Not CGI(TM). Come on,
stop *saying* it's better and *show* me it's any good. What features does
the language have? How would I go about using them? If PHP is so good, the
docs ought to be able to convince me of that without endlessly repeating it.
I also got tired of seeing what ought to have been one-liners written in
fifteen or twenty lines of PHP. Is the language really that needlessly
verbose, or are those just bad examples?
In summary, the documentation is so bad, I can't even make a decent evaluation
of whether the language is any good. The *first* thing the PHP crowd needs to
fix is the documentation. It ought to be rewritten from scratch.
Cut that out, or I will ship you to Norilsk in a box.
Yeah, sure, "just around the corner". That's what they said a year ago :P
Some interesting slashdot PHP5 references:
"PHP5 is well under development and a beta is expected out by March 2003 and released summer 2003"
Introduction to PHP5
General PHP5 References:
Changes in PHP 5/Zend Engine 2.0
Pidget: The PHP Widget Library
You know C. I never "sat down & learned" PHP - a coworker told me how to use echo (and print_r() for arrays, etc), and how to do open tags ... and the rest "just worked", as they say. Oh, that plus www.php.net's function search ... um ... function ... helped.
Half of it is just learning database usage; the other half is knowing C-style (C/C++/C#/Java) syntax, and it really shouldn't be hard to adapt to even if you're not familiar with any of those.
The best part is that you can even use it on a server to write scripts (logging, etc., w/o a mindset shift). Or that no plugins are needed b/c it's server-side.
Yes, I'm a fanboy. But it deserves it.
You said...
Thank you for bringing that up. That's been my biggest complaint with PHP. Some examples include:
It seems that any time there is an update for PHP, something else gets broken. I cringe when my sys admin tells me he wants to update it, because I know it's going to lead to hours of debugging work that I shouldn't need to do.
<?php while ($self != "asleep") { $sheep_count++; } ?>
Is it only me...I read 'PHB just around the corner'.
Tat Tvam Asi
How much will it cost for the add-ons necessary to run PHP on a high traffic server? You know, the cache that should be included in the base product but isn't because it would hurt Zends market.
There is much better alternative to PHP. It's called Zope. In fact, Zope has two similar (but very superior) markup languages: DTML and ZPT, both using Python for underlying scripting.
Just go to the site and check brief functional description - you will be surprise how far their technology has been developed for the last year.
Personally, I was developing on PHP before (like SquirelWebMail plugins, database applications), but I don't see any reason to write PHP anymore. All my current and upcoming web-projects are only Zope-based.
Less is more !
Just as an example as to how backwards compatiblity should work, Python has it about right.
For example, the current python version returns 2 when you type 5/2. In Python 3.0, the behavior would be changed to returning a float (2.5).
This could break plenty of scripts, such as parse_lines(file_size/2) where the argument could only be an int. Now, to the magic:
These future changes are announced years before the actual forced change in the language. However, for your current Python 2.3 program you can import future behaviors, like so:
from __future__ import division
Which will make sure that your division doesn't break once python reaches 3.0.
You often need to look at the contributed comments to get even a basic description of the topic at hand. You can tell by the tone of some of the contributed comments in the docs that the authors are astounded they needed to add their annotation.
Just wondering if PHP has come out of the 80s yet.
here's an idea
read the ChangeLog that gets posted with each new version to see what changes. that might give you an idea of what is going to break
vodka, straight up, thank you!
It is ugly as hell, what's up with object.__copy()? PHP had it's good days when ASP 3.0 was arround, but now with full OO, application oriented, instead of scripting oriented developing, it sucks. ASP.NET is supperior, just put mod_mono in your apache and enjoy compiled applications with C# or any other .NET language.
I think PHP's documentation has a mix of good and bad.
:-)
The function reference is usually quite good, and the contributed comments make a good reference excellent. It could be further grouped to become easier to navigate, grouping all the "database access" functions together in a deeper heirarchy, for example. (PHP in general is suffering from having too many functions IMHO - that may be fixed in PHP5 though).
However, the language reference, which is intended as an introduction to the language, is not great for beginners. It definately needs tutorials, and a quick reference to common functions used in real-life scripts. An overview to accessing a database would be good in here - connecting, fetching, resource handles, etc - rather than having to go to the function reference and guess the functions you might need. Also, it could contain a language-to-language comparison of commands and concepts to entice ASP/PERL/Python/LanguageX programmers to easily convert.
I can see that beginner programmers, or PERL/Python/LanguageX converts, would find some troubles coming up to speed quickly with the launguage based on the current manual. But as a seasoned PHP programmer I now find it is a great resource.
I agree with the parent poster that the user contributed comments are essential in understanding some functions, and this probably highlights some deficiencies in the manual. But the fact that a good community exists to add these comments, plus the manuals ability to store them, makes for an excellent resource.
All in all, I think the PHP development group is doing a great job, and I look forward to PHP5 (well, perhaps 5.02
This is a valid and insightful point.
We use PHP in the real world, for 600+ websites. We have learned the hard way not to upgrade, to stick with the same PHP version and upgrade maybe once a year at most - when we build a new server. Sounds daft but it's the best solution here.
If not, and MySQL is your bottleneck, I'd be curious to know how it affects that when enabled.
.02
cLive ;-)
-- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
If, like me, you find the PHP docs frustrating, then please consider the O'Reilly Programming PHP. I'm working on a large PHP project at the moment and this book has clarified a lot of PHP's counterintuitive strangeness (especially with respect to scoping) for me.
Vino, gyno, and techno -Bruce Sterling
READ HIS POST.
The point is some of these changes ARE NOT IN THE DOCUMENTATION OR CHANGELOG. The behvaiour of 'get_object_vars()' changed dramatically from 4.1.2 to 4.2 without a word in the changelog. I couldn't even find the commit where the behaviour changed. Only months later did someone acknowledge that it had changed.
creation science book