Professional PHP4
PHP is an open source server-side HTML-embedded web scripting language for creating dynamic web pages. Outside of it being browser-independent, PHP offers a simple and universal cross-platform solution for e-commerce, complex web, and database-driven applications. Professional PHP4 will show you exactly how to create state-of-the-art web applications that scale well, utilize databases optimally, and connect to a backend network using a multi-tiered approach.
Almost an year since its release, this book has stood the test of time, and proved to be what it promised -- an up-to-date, advanced book on PHP -- a category in which there are very few worthwhile entries to date.
It provides a solid, fast-paced drill on the rudimentaries of PHP (although the fast-paced installation instructions come in the form of classic compendia -- worth 100 pages) for seasoned programmers, before it plunges head straight into the more advanced areas of the language. Each chapter reads a bit like a tutorial on a particular area of advanced PHP development.
If you are a competent programmer in just about any other language or have grappled with HTML before, then this book will teach you PHP from scratch . It will also introduce you to many of the more advanced areas of PHP programming, and is a treasure trove for information on diverse tasks possible with the language.
Notable topics include:
- Object Oriented Programming
- Sessions and Cookies
- Coding an FTP Client
- Sending and Receiving Email and News
- Networking and TCP/IP
- Non-Web Programming (including GTK)
- PHP and XML
- PHP and MySQL/PostgreSQL/ODBC
- Security
- Multi-tier development
- Optimisation
The code for the examples presented in the book is available for download, from the publisher's web site.
Although this book is reasonably complete, it lacks sufficient depth for experienced PHP developers who want to wade into the depths of specific PHP related tasks. Having said that, the publisher has provided information (of course at a separate cost) on specific areas with their second level PHP titles -- Professional PHP4 XML , Beginning PHP4 Multimedia Programming , Beginning PHP4 Databases and Professional PHP Web Services .
Suffice to say that the book has packed together a lot of diverse information (in 975 pages).
Related Links You can purchase Professional PHP4 from bn.com. (You may also be interested in the Slashdot review of Professional PHP XML of a few months ago.) Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Its time for another PHP vs. J2EE vs. .NET vs. PERL vs. everything flame war...
Does anyone have links to news/features on what's supposed to be in PHP5? I've been hearing rumors that it's going to be much more object oriented and easier to do serious design work in.
Isn't this book review a tad bit late considering that PHP5 is going to be hitting the 'net soon?
I've said it before, and I'll say it again... the PHP website should be enough for anyone with basic programming skills. It's simple, clearly explained, and there's many examples and fixes posted by people. The only thing that would be helpful would be a PHP Cookbook that's as good as the Perl one.
You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
Yahoo recently started using PHP to run their site. PHP is not just another toy language to tinker with, its a very capable tool. Don't confuse 'easy to use' with 'not powerful'.
When you make a complete enterprise site, you use the language that will give you the most advantage for maintainability and design.
Exactly. PHP often fulfills that need.
http://twitter.com/onion2k
yea that why Yahoo is moving to PHP and not Java hmmm and here is slashdot articke about Yahoo moving to PHP
i have worked with both and i PERSONALY prefer PHP, I haven't faced a problem in php that I couldn't have solved....
Who controls the information, controls the world...
PHP is a great solution for small to mid size businesses. Designing server based database apps is easy and they can run on Linux/MySql (duh!) which is a great kick in the TCO for a small/mid size biz. While I agree with the earlier flame regarding PHP in the enterprise I do think it works pretty well for business apps just not with thousands of users.
One thing I feel is missing is the ability to USE the host system. If I could access serial devices for example I could have a pc as a database server and one as a cash register, then I could have a serial based cash drawer at the PC being controlled by the server (this is a fairly common POS setup) this would be very useful. (I know I can use Perl to do it)
I've been using php for about 5 years professionally and have actually been looking into using Java, mostly because I'm interested in the concepts behind MVC design.
But one of the things php has given me over the last 5 years is total rock solid stability. I mean, I've hacked up some complete crap code over the years but I've never once had a php related crash(and apache only ever crashed when we tried integrating Cold Fusion into it).
In testing Java servlets I have gotten out of memory errors in a database app I've written, but that could very well have been a lack of knowledge on my part(maybe I had the server misconfigged). I'm reading up more on admining/designing for Java now and will do more serious tests in the future.
But don't dismiss php as a toy language. The code you create can be messy, but it's rock solid stable. 5 years of 80k+ lines of code without any crashes is nothing to laugh at.
So whats new in this edition?? Whats diff between the professional PHP 4 book I bought like 2+ years ago , and this book?? or is this just an insanely late book review???
Actually, I thought they migrated using PHP for background scripting, not on actual pages that are displayed (I think they still use a proprietary C system).
Of course, this is all out of my memory, not actual links.
Funny thing is, I wasn't gonna start the "J2EE vs PHP for professional site" flamewar, and then someone else goes and starts it.
And PHP doesn't have the greatest OO built in that most architects drool over.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
Because its the best tool for the job!
I learned php a few months ago, but I think I'll stick to perl. If you're making some simple web pages that just need to be marked up, I guess php is okay, but why bother adding a php module to Apache when you've got mod-perl?
In Perl, the language helps you, but php just seems to get in the way. Without the equivalent of Perl's excellent DBI/DBD, I don't see much use for php.
I was going to pick up this book, based on the recommondation of friends (programmers) and online reviews, but when I thumbed through it in the bookstore, it just seemed...weak. Thin.
This is PROFESSIONAL PHP programming, not BEGINNING PHP. Why even have the 100 or so odd pages on installation? This book is not targetted at newbies, it is for the serious developer. OK -- you're a J2EE dude who want to check it out; doesn't have PHP installed. Lots of references on the Web, and if you can't find them...you're not a Web developer.
While the book probably would be helpful as a reference in some cases, I was just disappointed in it. The cookie/session section was a joke (and this is new in v4, so should be fairly rigorous).
I didn't buy the book. And I like having references around. I have 7-8 open on my desk right now, from Perl through DHTML to PHP. Oh well, as people have noted, v5 is coming, so I guess we shouldn't get our packets in a bunch...
It depends on what exactly the enterprise size app is doing and what it needs to connect to.
:)
For example, an enterprise wide phone extension list could easily be done using PHP instead of Java.
A complex work-flow application might not be the best fit for PHP. A whiteboard collaboration tool definatly would not either, PHP-GTK not withstanding.
I've used PHP to call both Java and VB COM objects on the same page. I had to work with two different groups in a company, one used Java, the other used VB. It was easier to use PHP than to write a wrapper for either.
"For a successful technology, honesty must take precedence over public relations for nature cannot be fooled." -Feynman
Thanks for the link. Now I can say, with confidence (from the article):
Yahoo has decided to switch from a proprietary system written in C/C++ to PHP for their backend scripting
Backend scripting != PHP pages on yahoo. This article wasn't read very well by slashdotters. They aren't converting yahoo over to PHP, they are using it for scripting.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
So the book is still up to date, even an entire year after it's release?
Something's wrong here... Those php people better get on the ball and start releasing more often! The only language I know of that's stays that stable is COBOL.
No point in playing with it, unless it's the latest bleeding edge, crashing and burning on a regular basis. On my Windows box, that is - my BSD box remains rock steady.
Nope, still not funny.
...a true troll who has never used the language. Or at the very least hasn't used it enough to see the true power and simplicity it provides when used correctly.
BlackNova Traders
I can't say how this book is for a professional programmer, but it's good for a newcomer to PHP. It is clear in examples although some of the items don't work perfectly.
It does cover what is claimed but as I recall it has some items that it explicitly states need work in terms of security. The biggest complaint that I had (it may be fixed now) was that the companion website at wrox did not work. There were some cookbook sections I wanted to test (where I suspect I did not type in something in caps) and I wanted to copy and plug. However it did not work.
cheers
And why do you think Java/J2EE is the best choice for an "enterprise" solution? The best choice has nothing to do with the language...it has everything to do with how the compiler/interpreter is implemented and what your developers are comfortable with...oh, and a word on portability, it is a pipedream for any application that is built for an "enterprise".
"Simon Says, Fuck You" - George Carlin
I have to prepare a report at my job discussing the merits of Perl and PHP and would like some ideas for good points to put across in favor or against either one.
Personally I favor Perl as I think it can do much more but I'm not an expert by any means and I'd like to present some reasonable sounding arguments, possibly in front of people who are experts in Perl.
Any ideas?
Oh, and another question. I'm not 100% sure how Perl actually runs the Perl code. I know it gets compiled to P code, but I'm not sure at what stage this is done. Can anyone tell me how this works or give me a pointer to where I could find it?
As usual, thanks for your help Slashdotters.
wow, did you mommy not give you the xbox you wanted for christmas?
what he was refering to is when I log into my yahoo email, Im not going to php pages, Im going to yahoo's c++ system pages. what they use php for isn't heavy bandwidth dependant, nor heavy user dependant like most professional sites. now, did I bring it down to your level, or should I use my kindergarden voice?
why don't you go shovel snow for extra cash so you can buy that xbox you want, instead of fuming over slashdot like an aimless loser.
IN SOVIET RUSSIA, silliness monty python proportions...uh...you? Maybe not.
Everyone that flames PHP needs to go sit in the corner and remember not to break their magic bubble of personal space. First the slashdot article is about the book not the language, second use whatever works for your needs. If PHP works for you and like it thats wonderful. If not use something else, there's a lot of other options.
PHP stands for "PHP: Hypertext Preproccessor". Not "Personal Home Page". It hasn't meant that for years.
Send your friends messages of love at fuck-you.org
I think it depends on what you need your site to do. If all you need is to run database queries and output the results (basically what /. does) then languages like PHP, Cold Fusion, Perl work fine. PHP and Cold Fusion make these kinds of tasks very easy to do and they scale just fine for these types of applications. Where I always run into problems is with applications that require much more...connecting to sockets on other servers to retrieve data and then parse data (XML etc), connecting to booking systems, middleware or mainframe systems, manipulating images on the server that kind of stuff. It seems most enterprise applications end up going beyond what languages like PHP and Cold Fusion can provide without having to write custom tags in C/C++ or Java or something to make up for the shortcomings of these languages. At that point you might as well write the application in J2EE or something that is a little more robust than what most of the web scripting type languages can provide.
I see php in lots of very busy sites.
Just today I noticed that Insight is using php. I am pretty sure they were not using that before and migrated to php from something else.
War is necrophilia.
I've been using PHP quite heavily for a few years now; I never picked up a PHP book, not once.. Why? Simply because the community support, the IRC channel, the Online Documentation and even places like devshed simply have so much to offer! I have not even once printed or purchased even a mere shred of dead tree painted over with ink that describes or outlines PHP in any way whatsoever.
You can write your own extension (in C for instance) to interface with the hardware - and provide the PHP functions you want.
See here for details...
BlackNova Traders
He said maintainability and design.
PHP vs Java when it comes to design isn't a contest. Java has much better built in OO than PHP.
Maintainability depends on how it is written, regardless of language.
I'd argue that the things to have for an enterprise site is how well you can design the language, how fast the pages run (including DB hits, etc), and how quickly it can be written.
Using the "what your developers are comfortable with" is what developers tell their bosses when they don't want to learn a new language. What if all your developers are comfortable with assembly?
the silliness of monty python takes on YOUR proportions!
Now if only I could actually find a job where I could use it.
:-)
Anybody?
-S
We Apprentice Developers and Designers
(* Designing server based database apps is easy *)
If you mean data input and query screens, I have to take some exceptions to that. Simple stuff is indeed simple in web apps. However, B-to-B and intranet managers often want GUI-like behavior from browser-based apps, and HTML+JS+DOM can turn into a tangled mess under such demands.
The developer cannot just say, "well, this is an HTML browser, not a GUI, so it will not have all the functionality of a GUI", because that would be a half-lie. With enough effort and spahgetti code, you *can* make it do GUI-like stuff, but the code is usually horrible. The current standards are optimized for e-brochures, and NOT e-biz-forms.
What is needed IMO is HTTP-friendly GUI browsers, using protocols like XWT and SCGUI (I'm still looking into Mozilla). (I rule out non-HTTP protocols because fire-walls often don't accept them. Some protest this, but I don't want to rekindle that debate here.)
There is a huuuuuge need for such in my observation, and no vendor is stepping up to the plate. PHP could still serve as the server-side part of such a system, BTW.
Table-ized A.I.
"And PHP doesn't have the greatest OO built in that most architects drool over."
Actually it has "pretty good" OO. In some ways it has "pretty advanced" OO like mix-ins. PHP5 will have "even more advanced" OO.
Anybody who uses J2EE for a "less then enterprise" web site is just asking for pain. Better to stick needles in your eyes it would hurt less.
If you really want to use java go with webobjects.
War is necrophilia.
So you think it isn't a good Professional book. Is it a good newbie book? Even if it is poorly named? I not a programer but would like to learn and have been learning PHP on my own. Would this be a good investment or waste of cash?
Slashdot, home of supporters of free software, free music, and free speech.Except for Moderators that disagree with you.
One - the book is OK, but out of date if only because of the 'register globals' stuff - they shouldn't have assumed it was on in a 'professional' book in the first place, imo.
Second - shameless plug - we offer PHP training classes. here
Third - PHP topics always devolve into 'java/perl/.net/asp/cf is better than PHP'. Anyone who is interested in putting together serious multi-platform tests between PHP and other languages, please contact me privately, as I'd like to arrange something with other developers. Not as 'one language beats all' but to present some tests which aren't sponsored by the companies (MS, Sun, whoever) which obviously have a BIG bias as to how they want the results to appear. Having a cross section of multiple developers from multiple platforms agreeing to common test terms would help eliminate that, I think.
creation science book
We recently switched from perl to PHP. Perl seems to be much better and handling file manipulations and it definitely is more a more complete language. But developing in PHP is so fast that the switch was easy.
.html with cgi-bin/php, all of my pages would still be served fine (although slower if run as a CGI.) What this means is that our layout people can design pages and we can easily put in code after the page design is done to make it look just like they want it. If they then want to move stuff around, they can (for the most part). They can even use editors like frontpage (and it won't complain about the php code if you use the code delimiters.)
With PHP, the default "thing" in a file is html that it just spits out. You have to do something special to make PHP code to run. So if I configured my server to handle
Also, with PHP you can also do things like this:
<? if (somthing) {?
Something was selected
? } else { ?
Something was not selected
? } ?>
so when I am printing out large chunks of html based on some variable, I can just use html without messy prints all over the place. Of course, you can use perl "print EOP" type statments, but I think the PHP approach is more elegant.
Also, the fact that PHP takes care of all the variable collection was a big plus for me. I just type testing.phtml?id=2&name="jeff" and sure enough, $id=2 and $name=jeff. Obviously, you can do the same thing in perl and it's not terribly difficult. But in PHP it is just that much easier and it's one more thing I don't have to worry about.
I would strongly recommend that you at least try PHP for a simple mail form or something. I think you'll fall in love with it for web stuff. And if you're doing database work too, then I think you'll really like it.
In Perl, the language helps you, but php just seems to get in the way.
Languages are subjective. I don't personally like Perl because it makes it too easy for other developers to write cryptic code (at least cryptic to me). Larry Wall focused too much on reducing keystrokes and not enough on readibility. I don't want to start a flame-war, for Perl fans are probably fast at reading Perl code. It just ain't for me.
Also, it encourages people to roll-your-own-half-ess-DB, which I think is a mistake because the data is then less sharable with other langs and apps and does not scale without overhauling the code. IOW, collection manipulation interfaces are not "wrapped" such that you can switch from nested arrays to a database without calling code rework.
Table-ized A.I.
This wasn't a review. It didn't go into any detail about the chapters or the nature of the examples and prose. Essentially, this was nothing more than someone paraphrasing the material in the forward, back page, and TOC. Completely useless.
Nahh, bro, I'll just to to your mom and ask her to buy it for me.
Seems like after your dad discovered the Internet, he's been spending too much time morphing scanned images of you onto his favorite kiddie porn pics, and masturbates to it once in the morning before work, and once when he gets back home.
That leaves no semen for your mom, which is where I come in, no pun intended. She'll usually give me around $50 a load every couple of days, but this being Christmas, I'm gonna ask her for $200 so I can buy my X-box.
Did you know she goes through your undies to look for extra cum stains to lick, just in case you had an accident? It's sad, she should go work at a sperm bank, I say.
I like PHP and web apps, and code a little here and there... but I must say that if you are designing a business app, security is of the utmost importance. Therefore, it seems to me that you can design a regular app (QT/$backend, or some other combination) to run on the server, and have the clients log in via ssh or something similar and have the app run on their desktops via port forwarding/X forwarding. This seems to me to be way more secure than SSL web applications, and eliminates the deficiencies you just mentioned.
Ok, there are problems with this scenario (what if the user's connection drops occasionally?), and these would be hurdles to overcome, but my point is that while web apps are 1337, there are other more traditional and perhaps easier ways of making an app with the kind of gui that's needed for business apps
Need a Linux consultant in New Orleans?
This is a fake post. Please note that Stewey is a troll who steals from other discussion groups. He has never had an original idea in his head. Please do not mod up.
FUD-OFF
Are these the same enterprise sites that ALWAYS seem to require javascript? <sarcasm>Are we to believe that J2EE is not up to the task of parsing user input</sarcasm>. Surely the developers realise that only morons allow third parties to run arbitrary scripts on their systems.. then again!
I've never used zend optimiser on PHP, I'd sure like to see some benchmarks comparing it with java. Of course there is no contest when it comes to actually maintaining the code - this is the reason I switched to PHP in the first place.
MVC is just an object-oriented design concept. There's no reason you can't do it with PHP. And, if you want a "middle tier" for PHP (persistent objects/connections, brokering, etc...), check out http://www.vl-srm.net/
The PHP website offers several relatively small windows help files that you can download and keep on your hard drive... if you want, it'll even display user comments. That way, you don't have to always be connected to the web while you're coding.
--
Vote for your hopes, not for your fears - Vote Third Party
Has anyone worked with the Smarty templating extension? It seems like it would lead to better MVC use, but I haven't had time to use it yet. Will I be wasting my time?
THIS SPACE FOR RENT
www.cgisecurity.com/lib
I know there are accelerators out there, but most people not know about or use them. Plus I really can't see the harm in including a accelerator in the default engine. Does anyone know why it is not included? There are open source accelerators that can be distributed with PHP.
Many scripting engines eg. Cold fusion, JSP, compile code only the very first time the code is executed since the module was started, then only check to see if the code was changed on disk before executing the already-in-memory code.
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
Can mod perl really offer the same advantages, e.g. in terms of low overhead, for serving a high volume of dynamically generated web pages?
I've read that php has a significant lead in this regard, but don't know all the details.
To answer your question about how/when perl is compiled, it depends on the situation:
As near as I can tell, PHP pages are compiled each and every time they are served, along with all the included code.
i see that filtering through the crap of your message, that you understood what I said. this means I was write, and your original quote was wrong. thats all I was after.
oh, and those retorts hurt me. badly.
I'm too lazy to click any of the book links, and I'm sure many people here have the same question anyway, so I'll post: does the book show variables the old way (just ask for $whatever and it pulls the value out of the air from POST, GET, etc.) or the new (4.2+) way where you need to say $_GET['whatever'] or $_POST['whatever']?
Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
Good: More helpful for quick-start than the web sites. Reasonably complete, with good examples. Good PostgreSql coverage (and MySQL, of course).
Bad: Some of the more obsucre aspects seem to have been simply copied from the web (same language, same examples). This is not helpful, if the original web-text was inadequate or obsolete.
Actually it has "pretty good" OO.
..
If I' had modpoints right now, I'd mod this up as "funny"
Any C++ or Java Developer will loose his hair (I he has any left) when reading things like this or this
(the later has nothing to do with oop)
Isn't "Professional PHP4" an oxymoron?
One thing that stirkes about PHP is it's position in the market. It simply ownz all other SSI technologies out there. From ASP over JSP to Cold Fusion, PHP is one of the outstanding successes of OSS.
Yet all these SSI technologies have in common that they still don't manage to really split Design from content. I was all in for PHP as my way of doing SSI stuff until I ran into TAL. It's the second (next to DTML) SSI Language that comes with Zope and has been reimplemented in Perl (PETAL). The essential difference to other SSI solutions like the #1 PHP is that all SSI-relevant tags only come as parameters to standard HTML tags and thus absolutly don't interfere with WYSIWYG HTML tools or other stuff that belongs to markup. You even can get good editors to switch of the non-html tal parameters to do your markup uninterfered. Once on the server content of tal-parametered markup (tal-speak: "mockup") get's replaced with the dynamic content. The point is: Either way you have documents that can be previewed in browsers, edited and formated without the source code for serverside dynamics being touched - or vice versa.
A simple trick to establish true separation of content and code.
We suffer more in our imagination than in reality. - Seneca
the 1st anniversary of the book's publication?
I haven't OO'd my PHP because I know the implementation sucks. I'm patiently waiting for PHP 4.3 (or whatever it is), and then PHP 5.
--Giving to trolls for the benefit of us all
Is there anyone with much experience doing PHP-GTK? On the outside it seems like a nice way to use PHP's DB interaction on the desktop, but it seems the development is slow on it and I haven't seen many people using it ( and have heard bad things about it, but from the same people who say bad things about PHP).
Phrame is a PHP version of Struts.
-B
Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.
Trolls teach you!
However, I think thats true of any web content program no matter what language its programmed in. I've seen Scoop/Slashcode frustrate people as much as PHP-based programs.
However, I think PHP works outstanding as an abstraction layer between SQL and the web for smaller sites.
C - A language that combines the speed of assembly with the ease of use of assembly.
- The OO of PHP is excellent. In my experience, it rivals Smalltalk. We all know that Perl's OO still needs work (whether or not OO is all that great is another discussion.)
- Outstanding database support. PHP supports virtually every DB under the sun (although Berkeley DB is missing, oddly enough.) Perl 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 Perl 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 Perl in most cases. File handling and regex come to mind immediately. I'm sure there are cases where Perl 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 Macintosh servers and have it run without having to change a single line of code. Try doing this with Perl! Its as though it was written in assembly, Perl 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. Perl lacks a graphics library of any kind.
Again this is just my experience. I don't mean to offend any Perl coders because Perl is an excellent language. However, in certain cases it may behoove one to write the back end in PHP instead of Perl. Thank you, ETC - A language that combines the speed of assembly with the ease of use of assembly.
How about this?
and a much more complete object-oriented programming environment will allow PHP to provide a powerful Web front end for enterprise-class .NET and J2EE-based applications.
What exactly is "enterprise-class"? Lots of users? Lots of PHB's to get in your way because they read some buzzhype in an airline mag? What does it mean?
This "separate content from code" cliche is a bit overused. A clean separation is often impossible because there are always exeptions that mere classification tags cannot take care of very well. You need fine granularity and boolean rules that only code can provide. Plus, if it is an intranet app, then changing your "skin" every full moon is not a very high priority. Put the "content" into a database if you want it dynamic.
TAL looks interesting, but it does get tiring reading people say over and over things like this:
"Yet all these SSI technologies have in common that they still don't manage to really split Design from content."
Any web scripting language worth its salt has at least one templating system available for it. For PHP I prefer smarty.
The links you point out all refer to the fact that php does not act exactly like C++ or Java. Once you actually learn the way php works those particular things don't bother you anymore.
Yes php does not work like C++ or java I don't think anybody is arguing the opposite. I suppose lisp, smalltalk, ocaml, python and perl also don't work like C++ or Java. That's life.
On the other side neither C++ nor Java allow you add methods or attributes to objects at runtime and PHP does. Maybe that's a good thing, maybe not, but I like it and whenever I use a language like java It makes me loose my hair when I can't do it. You have to take each language as it comes.
War is necrophilia.
One of the main reasons yahoo went with php instead of java is that freebsd currently has lousy thread support, which is quite essential for java apps.
Another thing is that they still use their proprietary backend code, they are not going to rewrite that in php (or java for that matter).
Yeah I know - it has developed over time. But generally the issue of templating is not so far from an general programming language. You'll never have such a clean separation.
There is a PHP Developer's Cookbook -- by Sterling Hughes and with contributions by Andrei Zmievski (if that last does not ring a PHP bell, forget it...).
./ for info!)
Not a good book, in my estimation. I've never thought I was king god of coding or whatever, but this book (and others) left me thinking..."Yeah, I learned [that] but...I already knew [this][that] and [the other thing]. I've never used it.
While people have posted saying to use the PHP manual (which rocks, don't get me wrong, especially for bugs), it's not a cookbook or a good guide for newbies (either to PHP or a particular function). This is where books shine: Show how this or that actually works in practice, not abstracted out to the API.
That said, use what works for you. PHP examples/code abound on the Web -- leverage this resource if it works for you. If you want a book, get a good on. (But view
I lurk on the php-dev mailing list, and one thing that I'm worried about with respect to the direction PHP5 is taking is the support for namespaces. The latest preview alphas of PHP 4.3.0 with Zend Engine 2.0 (as opposed to ZE 1.0, which powers the latest stable version, PHP 4.2.3) has demonstrated some of the above features in action (but they are, of course, still in-development.) The current 'implementation' (and I'm using that word loosely) of namespaces/packaging is something called 'nested classes', and let me assure everyone of the following: Zend Engine 2.0's "nested class" feature do nothing for implementing useful namespacing! Nothing!. They don't even work for logical things you would think they would. With nested classes, only the parent class can extend any other, and the nested ones absolutely cannot! Example: Even the latest from-CVS snapshots (cvs co php4-ze2) crock with a very specific error message: "Nested classes cannot inheirit." So how exactly do these help in namespacing? They don't.
Even the following like seem like a logical ability for nested classes, but ZE2.0 just doesn't support it:
So, hopefully the above looks like a start, and, of course, this would provide the necessary generic interface so that other RDBMS could be implemented according to the same mechanisms. However, the above doesn't even begin to work as expected in PHP with Zend Engine 2.0.. In the MySqlDatabase class, we might see a nested class like 'Connection' and think it would relate to the parents' subclass by the same name. So, using condensed symbolisms, like this:
* P is parent
* P defines 'n' as a nested class (P.n)
* C is child of P (in PHP, 'class C extends P
* C defines 'n' as nested class (C.n)
I would propose that it would make sense that 'C.n' implicity extended 'P.n'. That could be useful, for example, in the above database example: a single root class, SqlDatabase, could provide a variety of interfaces that are grouped together and not disjoint. So not just a bunch of related classes like MySqlError and MySqlConnection but a single MySqlDatabase class (with nested classes) that implicitly in the language relate the nesteds' amongst themselves.
But nested classes are not namespaces. PHP needs a syntax like that of Java mixed with Python, and, being a scripting language, PHP should allow namespaces to be first class language objects that can be manipulated, and they should have clearly defined scoping rules. Example: I admit that the scoping rules could be tightened. For example, after a broad 'package x;' statement, what if you wanted to define the contents of a subpackage using the 'package y { }' syntax but wanted the 'y' namespace to be under 'x' (so that anything defined in y would be prefixed globally by 'x.y.')? Edge cases like that would need careful consideration, and the only thing I can think of at the moment is a separate 'subpackage' keyword that would work in conjunction with 'package x.y.z;' definitions to consider 'subpackage w' to be really referring to a 'package x.y.z.w' definition.
I just want PHP to be even greater because I love it. I am working to document some of these ideas and the make the case for some more of these kinds of additions to the language, as well as coding the patches against ZE2.0. If anyone would like to share their ideas with me or help me work on this, please feel free to email me at pete (at) petrasync (dot) com (and sorry for some of the misformatted code blocks -- they are a tad difficult to get right.)
Pete
can someone at least set the parent of this ( "A Criticism Of PHP5's Namespaces (plz read! :)" ) up tp +1.
;)
:/
some interesting points, i'm going to come back and re-read tomorrow when i'm a bit more awake
wish i hadn't caned my moderator points yesterday
I really appreciate your kind words.. I wish I didn't post at 0, but as you can see, I'm trying legitimately to get that up but as well, shed some light on current PHP problems.
Pete
For the faint at heart when learning code: The beauty of PHP is that it is very similar to Javascript, Flash 5.0-MX ActionScript, and it works sooo easily in your own webpages. You can almost copy and paste code from Flash, javascript to PHP... (code geeks, forgive the over simplification here, but that's how it feels to a novice like me.)
/.esque posts on many of the pages of the online manual that are extremely helpful at relating code to reality for beginners.
:)
I am a multimedia designer(ie, I suck at programming but draw pretty circles, but there are no jobs anymore drawing pretty circles without code to make them spin when clicked on, so now I program too.)
Also php.net is an incredible resource with
Also a bonus, good PHP hosting on Linux is consistently more available and cheaper than on M$ based hosting systems.
Also, you don't _have_ to actually buy a book to get started with it.
-v
I've heard of this tag based marketup idea... I think it was called Cold Fusion (or Cold Frustration depending on your point of view)
Has anyone ever noticed that most developers using scripting languages tend to use mulitple languages, Perl/Python/PHP/Bash et al... what ever is best for the job.
But teach a guy a little Java he thinks Christ has returned and Heaven is J2EE compliant.
So the PH of your poop is on? We've tested it and found it to be not good. You'll need to change your diet immediately.
well i did finally get back to read it, and there are some interesting ideas.
:/
:)
to be honest, the only languages that i've used in an OO fashion are Java and PHP, and with PHP i've always treated it quite like it was java (as much as that is possible), including only having one class per file. i quite like that restriction, as it makes things easy to find, and reduces room for complexity and variations in naming conventions. but as i say, java was really my first introduction to something resembling proper OO, so im probably missing the advantages of what you are proposing
never the less, i'll keep an eye out for you next time i get some moderator points