Changes In Store For PHP V6
An anonymous reader sends in an IBM DeveloperWorks article detailing the changes coming in PHP V6 — from namespaces, to Web 2.0 built-ins, to a few features that are being removed.
← Back to Stories (view on slashdot.org)
This looks pretty awesome.
I make websites and stuff. Buy one.
Crikey, I can't believe I have to RTFA to come up with something funny to say about this short-ass summary!
Do it yourself, because no one else will do it yourself. [beta blockade 10-17 Feb]
No comprende? Let me type that a little slower for you...
No more magic quotes makes AC a very happy coder.
I don't see why this is a major update (5 => 6).
Soap & XML was already implemented which leaves namespaces and unicode support as new features, and a bunch of stuff removed
... for those too lazy to RTFA:
Additions:
Better Unicode support
Namespaces! (this is being backported to PHP 5.3)
SOAP and the XML Writer/Reader modules compiled in and enabled by default (also in PHP 5.3)
Removals:
magic_quotes, register_globals, register_long_arrays, safe_mode
ASP-style short tags ()
Freetype1/GD1 support
ereg (use of preg encouraged instead).
Better XML support. That's a biggie. Might it mean we can, for a whole heap of projects, discard mysql? Would it make things run faster?
Do it yourself, because no one else will do it yourself. [beta blockade 10-17 Feb]
Especially since most of the "new" features are either already available or will be included in v5.3. There's literally nothing new here except better Unicode support.
Developers: We can use your help.
I just came here to help support open source. The articles may not always be winners, but the tag lines and comments make up for that.
Yay! Finally not just having register_globals defaulted to off, but removed altogether.
i am servicing around 350+ clients in a small fish web host. even at that small web host, there are a phletora of different scripts, programs that clients are using to conduct their everyday business, their estores, their livelihood. some of them are dependent and locked-in to the software they are using like a small business company that extensively uses ms products is locked into microsoft.
regardless, backwards compatibility is important for those people. for starters, these are the people who have chosen php as the platform to conduct their business on, making php a de facto dominant language for the web instead of being a small time web language that was used on web savvy, webmasters. the financial impact of this is going to be huge for them, to adopt to that many changes php dev group started to introduce in the span of 1 to 2 years. this is too much.
you gotta slow down. or you are going to alienate the small business community from using php with what you are doing. if you break a small estore owner's store script every 1.5 years for 'upgrading', the second time you do it they will jump the language ship.
do not start to become an elitist group out of touch with the people, increasingly caring for nifty programming issues rather than what would the users think.
Read radical news here
Removing the get_magic_quotes_gpc function altogether seems like the dumb way to handle backwards compatibility, breaking scripts for no good reason. Why not keep the function and just always have it return false?
Developers: We can use your help.
If they just leave it, people will go on thinking things are good, until they're hacked. By throwing up a hard error, people will be aware there is a problem. If it's really such a problem, don't upgrade immediately, or write your own replacement function.
It was to protect you from the O'Malleys and O'Connors. The PHP framers were obviously fans of Mel Brooks' film, Blazing Saddles: "We'll take the niggers and the chinks but we don't want the Irish". Or I'm missing something.
THL phish sticks
Absolutely. It's not like anyone still uses PHP.
I simply can't wait for an even bigger php.ini file to support disabling and re-enabling of deprecated functionality. I've spent several evenings over the last few weeks on a contract to clean up some really bad PHP code, and a good fraction of that time has been spent actually getting a test bed up and running, trying to match the Win32 PHP 5 install I'm forced to work with the Linux PHP4 install on the production server. More than ever before I'm convinced that PHP is the worst major language ever invented, and I'll wager PHP6 only makes it worse.
The world's burning. Moped Jesus spotted on I50. Details at 11.
Make it like a modern language.
Change . (string concat) to +
Change -> (pointer-to-member operator) to .
Done. Huge productivity increases.
Thank you.
Um, no it's not. It's only downfall is that it's too easy to do powerful things so idiots make dangerous code.
That is not the language's fault. Not everyone wants or needs a JBoss server or something equally silly for their website. PHP is still very good. Safe programming in PHP just needs to be preached more to the new users of PHP and some of the self taught people who perhaps learned off the net from someone else with little experience rather than a book since all books I've seen cover the basics on safety.
The only thing that annoys me is the fact it's function naming methods aren't consistent. It shows that it's had input from various places without any thought into standardizing things.
You moan - yet you took the contract.
Biting the hand that feeds you just a tad!?
AT&ROFLMAO
They've fixed a lot of things that were being complained about under the terms "why php sucks" http://www.google.com/search?q=why+php+sucks . ::\/\. /> :-)
Related news is that PHP runs much better now on Windows Server 2008, as per the official Zend statement. But I doubt we will see too many people switch to WISP. This is flambait, agreed.
Also if you now have a PHP-fed brain with no place for anything else, with the new namespaces-on-steroids (http://www.php.net/manual/en/language.namespaces.using.php) change, you'll likely port slashcode to
And otherwise refer to <things like="this"
Hackers have long memories. It works both ways.
People USE Unicode?! Back when I was a youngin' we used ASCII and LIKED IT!
Don't be daft, PHP 5 is a solid language and it doesn't take much to learn how to write secure code. If you view it from a rookies point of view it could be dangerous, but that doesn't magically make the language crap in the hands of more experienced developers.
PHP scripts will still manually implement it, and each one will do it in a slightly different but still broken way, generating hundreds more security vulnerabilities...
As opposed to fake ones?
Beyond that, and the pervasive "make it easy to do the WRONG thing" un-philosophy, I still haven't heard about it getting lexical scope, closures, and anonymous functions. Of course, this only matters if you're a good programmer (as opposed to merely a Decently Adequate one).
The World Wide Web is dying. Soon, we shall have only the Internet.
You sir live in a dream world.
So, if you're a developer or architect using a different language, such as the Java programming language, because it has better internationalization (i18n) support than PHP, it'll be time to take another look at PHP when the support improves.
Err, no we're using Java because it's a coherently designed programming language and set of libraries, not just because it's got Unicode support throughout. At least they're removing som of the horrific hacks like "magic_quotes" and "register_globals".
Well... Don't take contacts when you're not familiar enough with the technology it requires so that you don't need to struggle with it at all?
This is Slashdot. Common sense is futile. You will be modded down.
I've noticed that every single article here mentioning PHP is immediately tagged 'phpsucks'. I find PHP incredibly expressive and am always surprised by the incredible variety of libraries/modules/plugins to manipulate graphics, flash, pdfs, to support protocols like SOAP, JSON, etc.
Perhaps we need an article on 'why php sucks' ?
Don't be daft! PHP is a poor language, I needed unsigned ints and native utf8 string handling 8 years ago. My problem is that much as I malign PHP and have tried all the alternatives, I've not really found anything better.
But the developers aren't really helping at this point. Why they can't sanely rename the inconsistent global functions and have a secondary alias table for backwards compat I'll never know.
Are short tags being removed, or deprecated? I remember reading that the devs had decided to leave short tags in.
No offence php, but <?php echo "Hi!"; ?> does not even *begin* to compare to <?= "Hi!"; ?>. Hiding behind "it breaks open xml tags", or that "default configuration has them disabled, so using them is not immediately portable across hosts" is bullshit. If I'm coding for my own environment, *I* will choose which format I use, and I should not be expected to use ugly syntax to make things "portable".
Since it takes less resources and performs better, most hosting companies run all php scripts as the same user. Yeah there are ways to jail it to a certain directory per user but that's not very secure. PHP's stance has pretty much been it shouldn't be the languages responsibility to come up with the security.
Open Source Java DAO Generator
My biggest issue with new PHP changes is fact that the sheer size of the PHP libraries mean that these new features don't bubble through to the whole core.
For exmaple take the newish try / catch exception features. On first glance you think "finally I can write decent exception handling into my own code" - which is great for your own exceptions but too many of the core functions used by your code or by a framework you're using don't throw exceptions - they indicate an error codition in the function's result.
So now we're seeing loads of code out there by people trying to do things "The right way (tm)" but it's full of bugs as there's exception conditions being raised by core functions that don't get caught by the catch blocks.
The line from TFA that concerns me is "Much improved for PHP V6 is support for Unicode strings in many of the core functions"
Many? That will means developers will start using unicode only to find scattered lines of code throughout the app doesn't work as the core function it uses doesn't support unicode. The overhead of keeping track of which functions do and don't support unicode will be a nightmare.
Would you really expect the same people that fucked up the language as bad as they did to suddenly fix it?
Do you even lift?
These aren't the 'roids you're looking for.
No, it makes the language total crap.
* In the hands of inexperienced developers, (it's primary user base), it's horrible because almost everything you do the default way is insecure.* In the hands of experienced developers it's missing all kinds features that nearly any serious application needs.
The segment of people for which the language is not crap is really very small.
s/unicode/$foo/gi
I suspect this will be modded troll, and that would be fair. Go ahead. Has to be said, though.
Some languages, I see the point of. I understand why Visual Basic still exists, even if I despise it. I understand why C exists, and even why Java exists.
PHP, I just don't get. Why bother? It's Perl, minus a bunch of features, in a templating language. As soon as you discover that other languages can be embedded into a webpage, too, I cannot think of a single thing that PHP does better than just about anything short of C intended for developing web apps.
The one thing that I can appreciate about PHP is the massive amount of stuff that's already written in it -- like COBOL, it will remain popular and used for that reason alone. But unlike COBOL, it continues to be actively developed, and used for new projects. Why?
Were it just about anything else, people might come to me with code samples, showing at least one niche thing that their pet language does beautifully, or at least, that they believe shows it lacks a weakness of some other language. Prove me wrong -- show me some beautiful PHP code.
Don't thank God, thank a doctor!
Unicode support is reported to become available for 5.3+ later as a module.
What I've heard the developers say, basically, is that there is no real roadmap for 6.0, since 5.3 has most of the planned features and unicode (the big new thing) will be available sometimes, although not built-in.
We've always been at war with Eurasia.
Open Source Java DAO Generator
What makes PHP nice is that, language-wise, it is basically C plus a subset of C++ wrapped up in a scripting language. Almost any code written in C (or C++ without templates/exceptions/other icky stuff) can be trivially ported to PHP by replacing the type names with "var" and adding dollar signs in the right places. (I'm exaggerating slightly, but not much.)
PHP doesn't have any weird syntax like Perl regular expressions---you can do Perl regex, but it is neatly encapsultated into proper strings the way it should be. There's no having to manually re-indent dozens of lines of code because you needed to add another nesting level and whitespace is part of the language, etc. It's just a really clean, lightweight OO language that's exceptionally easy to learn and happens to integrate very well with HTML.
Don't get me wrong, PHP has plenty of weak points when it comes to performance (particularly when dealing with massive complex data structures), availability of modules to do various obscure things, etc., but as a language, it is pretty nice, IMHO---mainly because it isn't a kitchen sink like Perl.... :-)
Check out my sci-fi/humor trilogy at PatriotsBooks.
Apparently writing about PHP automatically allows using dumb code in examples:
;)
function is_authorized() {
if ($expression_that_returns_boolean) {
return true;
} else {
return false;
}
}
and
echo "Welcome, $_GET['cross_site_scripting_attack']!";
I guess PHP needs magic_entities
1. They don't just USE Unicode: they put it into XML by the megabyte! ...
2. Then they came out with a functional programming language called XSLT on top of that.
3.
4. Profit!!1!
That's pretty unfair circumstances under which to judge any language.
"Thanks for all the money you paid to us. We've used it to buy off ISO among other things" -Microsoft
Wait, you're going from Linux php4 to win32 php5? or is it the other way around? Either way, that's atroscious. Why did you think you /wouldn't/ have a horrible time with it?
Nothing inherently wrong with PHP in this scenario; you've been forced to inherit somebody else's disaster. THAT'S your problem.
php's success compared to other languages like asp, which tried to compete with it and came out about the same time into prominence is due to php becoming more than a small nifty toolset for doing knickknacks on hobby sites and forums. php started to be used for business, and this created a demand for php programmers, and this in turn fueled more entry into language. same did not happen for asp. go check elance. youll see zillions of php projects that are put up, and equally many php developers. search for asp and .net stuff. see how many.
the scripts which have a lot of old versions still being used out in the web today were a major cause for this. hell, even many simple forums that were started as hobbies turned into big community forums that do a lot of advertising and generate business, leave aside estores.
its not wise to go trigger happy.
Read radical news here
Did you have to shower after writing this? Did you at least burn the keyboard?
how to invest, a novice's guide
Comment removed based on user account deletion
Hopefully they can fix exception support in PHP 6. Currently it breaks in a lot of weird ways which can be nearly impossible to debug. For example, the following code:
function a() { new DateTime("2007-02-32"); } register_shutdown_function("a");
Generates:
Fatal error: Exception thrown without a stack frame in Unknown on line 0
Tracking down such an error in PHP 5 can be quite time consuming since current debugging solutions only work in very limited situations.
Name a language that can be used for web development that isn't dangerous in the hands of inexperienced developers.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Maybe they just ran out of people to use it.
That's the problem with PHP. It requires all the hard work of writing C-like code, without any of the benefits that one might chose C for.
> Name a language that can be used for web development that isn't dangerous in the hands of inexperienced developers.
Why? Nothing I said assumes or even implies there is such a language.
Can you name a car that's not dangerous in the hands of an inexperienced driver? Does that mean you would recommend inexperienced drivers learn to drive in Ford Pintos?
I see that.
PHP doesn't have any weird syntax like Perl regular expressions---you can do Perl regex, but it is neatly encapsultated into proper strings the way it should be.
Interesting example of PHP superiority. Perl regular expressions are delimited with / (or another character) because it's part of the language syntax. But if your regular expression is encapsulated in a string, there's no longer a need for it (which would simplify things since you don't need to escape it). Yet the pcre functions use a delimiter. Monkey see, monkey do. Without knowing why.
Do you even lift?
These aren't the 'roids you're looking for.
First of all, if you don't re-indent your after adding another nesting level, you are making your code hard to read, and if I have to work on it after you, I will hate you for it. This is one of the reasons that Python is so pleasant. It forces people to write decent code.
Secondly, if you're manually indenting each line of code, you should start using a modern text editor.
"What language should we be using and why?", null);
+ }
+ ?>
#P
When driven safely, there's nothing wrong with a ford pinto. Sure it's not the best car out there, but it will get you from A to B. And what do you even mean by "doing things the default way", in reference to PHP. Is mysql_query("SELECT * FROM Users WHERE UserID='" . GET["USERID"] . "'") the default way of running a query. Because that's the way most beginner PHP tutorials teach it. Or is the default way to use mysql_real_escape_quote. Or is the default way to use a prepared statement, using PDO. If you think the default is the first way, then I would blame the problem more on badly written tutorials than on any problems with the language itself.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
That's because PCRE syntax is more baroque than most people can remember. /(?i)foo/ is more general but all the code I've ever seen uses /foo/i, so the trailing delim is needed, and the leading delim is there to match it because you could use something other than /.
Not really. Ever try to do lots of string concatenation in C? The realloc function is not anybody's friend.... PHP is like C without its most obnoxious flaw.... :-)
Check out my sci-fi/humor trilogy at PatriotsBooks.
Depends on how significant the change is and the probability that you're going to reverse the change in five minutes. I can't tell you how many times I've added an "if (0)" around a giant block of code temporarily to test something.
And yes, I'm manually indenting. I vi, therefore I am....
Check out my sci-fi/humor trilogy at PatriotsBooks.
...You have to... burn the keyboard?
Really?
Like what?
Really, can you give me one example of the "hard work" you're talking about?
> When driven safely, there's nothing wrong with a ford pinto.
... make sure you're escaping much more than quote's in your database input ;-)
That's exactly my point. The inexperienced driver is unable to drive safely. Therefore it is especially important that they do not drive a vehicle which explodes on impact.
Re: your note about 'default' - yes, in the context I was writing I consider the first to be the "default". I understand that wouldn't apply to all contexts. But I don't think you can so readily separate the language and the community. Yes the tutorials could teach one of the more correct ways to do it - but it's much harder. It means people have to know all about what escaping is and when to apply it, or they have to install and grok PDO which their hosting provider might not even have. So they start with the easiest way. In other languages the easiest way is likely to be the (more) secure way.
NB: I assume you meant mysql_real_escape_string rather than mysql_real_escape_quote, but in case not
Cheers,
Simon.
Secondly, if you're manually indenting each line of code, you should start using a modern text editor.
Aren't you contradicting yourself here?
More pointedly: If poorly-indented code is so troublesome that you'd "hate" the offending developer, you should start using a modern IDE.
...He took the "contract." Nobody was forced.
But his post is inane.
Isn't it about as basic as it gets that code (outside of Java) should be developed on the same platform that it will ultimately be deployed upon?
If he had done that, all he'd have needed to do was get a copy of the binary as compiled for use on the production server, and their php.ini. Install, copy in the php.ini, and he's up and running in an environment identical to the Prod server.
Barring that, if he'd had gotten their php.ini anyone w/ any PHP experience would be able to see what non-std components were included, and the version everything is running at. Download it, compile it, install, and copy-in the php.ini.
If he's spending a "good fraction" to get a "test bed" then he really should stick to tech support or network administration or whatever he's done over the past few years full time for a living.
I use Kate. Click & drag to select a large chunk of text, then tab/shift+tab to indent/unindent it. Trivial.
Don't thank God, thank a doctor!
I do want a certain amount of control over the structure of my code, even if a lot of it will be by convention. Having any automated tool try to "fix" someone else's code is likely to screw up things like comments which are cleverly indented and aligned with some code, or similarly interesting code.
And an IDE is overkill in many other ways, yet they still often find ways to miss some functionality I want. That, and I tend to be much more easily able to switch text editors than switch IDEs.
Disclaimer: I'm not GP, and I use Ruby.
Don't thank God, thank a doctor!
Sure. PHP is simpler, but it's not like it's hard. The fact remains, for a scripting language, PHP requires you to do far too much work. More work leads to less maintainable code. At least in the case of C, the extra work is justified.
It's the only way to be sure.
how to invest, a novice's guide
Actually, I don't care, as long as you're not writing spambots in that language.
Don't thank God, thank a doctor!
What the heck is g_string_append? It sure isn't part of the standard C libraries in most OSes. Without custom, nonstandard string libraries, in standard C, that looks like this:
See why "$s = 'Hello' + ',' + ' ' + 'world';" seems so nice by comparison? :-)
Check out my sci-fi/humor trilogy at PatriotsBooks.
OO? Only recently.
Clean? Not even close, not when you've used a real OO language. and happens to integrate very well with HTML. So does everything else, now. I'd argue Ruby is actually better at this than PHP. Don't get me wrong, PHP has plenty of weak points when it comes to performance My language of choice right now is Ruby, so I don't really care about that. availability of modules to do various obscure things Considering the amount of crap built-in to the language, I doubt that's a huge stumbling block, either. I like CPAN, but it does help when the language itself is clean enough that I'll happily write a library of my own. But most that I'd need to do with a C library has bindings everywhere I really want to do it. mainly because it isn't a kitchen sink like Perl I think Perl has too many built-in functions, available everywhere, completely un-namespaced, compared to Ruby.
But you know what? Perl has a little over two hundred functions in the main namespace. PHP has a little over three thousand, according to this page.
So, it may not have the kitchen sink in the syntax, but it has the kitchen sink, the bathtub, the plumbing, and the neighbor's shower in the core library.
Finally, I call BS on this: Almost any code written in C (or C++ without templates/exceptions/other icky stuff) can be trivially ported to PHP by replacing the type names with "var" and adding dollar signs in the right places. (I'm exaggerating slightly, but not much.) Is there a language, other than Python, that this isn't true of, for very simple, "Hello World" or "My first HMAC implementation" examples? Sure, the rules would be different, but dropping all the type declarations (swapping for "var") and adding dollar signs is significant.
Oh, and does PHP support structs? What about function pointers? I doubt it's "almost any code". It's easy when you understand both C and PHP, but again, I assert that's true for many languages, particularly popular web scripting languages.
Don't thank God, thank a doctor!
Honestly, any IDE worth it's salt has by now solved the auto-formatter problem.
It's a by-demand feature so it's not like Word AutoCorrect. And you should be able to use a nice WYSIWYG editor to build the rules.
This is what you get, for example, in Eclipse and Visual Studio.
Personally, I like things like integrated FTP, integrated subversion, integrated unit testing, and, most of all, an integrated server-side debugger w/ all expected function: breakpoint/play/step control, stack and heap manipulation, etc.
All of these are possible using a text editor, but you need 5 different applications and none of it works together.
Not to mention: INTELLISENSE and DATA TYPE DISCOVERY! (on a loosely typed language that's a big help).
Instead of having to basically memorize or manually lookup class names, method names, and method arguments, I just begin typing the class name, use some arrow keys, and be done w/ it.
Anybody using an IDE w/out these features is fine by me, but for good measure they really should bill a customer less than those of us do that are using these tools.
You're deliberately handicapping your productivity. The customer shouldn't pay for that.
While I agree with your point let's not forget that it can be all things to all people. M0n0wall (and forks like PFsense and FreeNAS) uses PHP for shell scripting like startup and configuration scripts which I thought was pretty cool.
You want fun, go home and buy a monkey!
Something like *Tidy is all you need if you don't feel like using some fancy text editor or are too lazy to configure your editor.
http://perltidy.sourceforge.net/
http://rubyforge.org/projects/tidy
http://tidy.sourceforge.net/
etc
ZERO ZERO ONE ZERO ONE ZERO ONE ONE! Just brushing up for my next big invention: Ethernet over Voice (EoV)
Can you be more specific about how PHP "has a focus" on Web scripting? Everything you've listed is available in other scripting languages, and they also offer a lot more. It is also not at all clear why e.g. loose typing is a feature relevant to Web development in particular.
First, the PHP code doesn't really make sense. Why are you passing in the $args parameter?
All this code is doing is accepting a method name, validating it as valid (yes, an Enum dt would help here), and returning it if it is.
In which case, this is much better:
if (is_callable($method)) {
return method;
}
Or, more on point, you'd never even call the __call() method, you'd just call is_callable().
I think the point is to show a plausible example of PHP being "hard work like C."
I'm not a PHP apologist. It's got a lot of problems. Chief among them a glaring inconsistency that just makes an elegence-loving guy like myself cry my eyes out. But to say that it's "hard work like C" just because it retained a syntax and offers up some thin wrappers around C functions is, I believe, disingenuous.
PHP actually does have anonymous functions, although they're implemented in a somewhat clunky fashion.
Schlock Mercenary
I just can't believe they are not implementing named params for functions. I am in just total shock. That is one of the biggest things that python/ruby have over php and they are not implementing it?
Why why why? This boggles my mind.
023AD01("Child", "Evil");
Well, at least the sample code has clearly been written by a PHP expert. For example, a newbie would write something like
and get paid for just three measly lines of code.
Thank $deity Nathan A. Good (mail@nathanagood.com), Senior Information Engineer, Consultant stepped in and corrected this to
Go, consultant-written code, go!
Loose typing and non-strict syntax in general is particularly well suited to the internet because each request generates a completely new environment. Something that was wrong with the previous request, unless specifically stored, doesn't affect the next request. Strictness in programming stems from the need to keep far flung parts from affecting each other; the web is modular by nature and thus resistant to wide spread bugs. Thus, loose typing and other, less strict forms of programming that make life easier at the expense of fragility is counterbalanced by the modular nature.
Many won't agree with that analysis, and that's fine. Sloppy coding has gotten more than one web project in trouble, and more than one feature of PHP's that was intended to make life easier ended up going to far and introducing security holes. But that doesn't change the simple fact that PHP was made for the web and has conveniences built into the core that other languages either don't have or require an add on for.
Back when I was a youngin' we used ASCII and LIKED IT!
I see your ASCII and raise you an EBCDIC.
W
Would you believe... MouseText? PETSCII?
-------------------
This is my SIG. There are many like it, but this one is mine.
I've worked with PHP professionally, building a healthy, heavily profitable, and rapidly growing company providing information management services to schools.
.NET wished to be, only cross-platform. It's an excellent tool for developing information-processing applications, very, very rapidly. Yes, it has its weaknesses, and nobody's forcing you to use it, and the devs are working on the weaknesses, too. Go use Ruby if it makes you feel good. But PHP works well on Windows, Mac, Linux, BSD, and many others. Seriously: you really can't go too wrong betting on PHP unless you need 3D graphics!
From the simple standpoint of "concept to implementation" - PHP ROCKS. It's very, very fast, requiring little in the way of "planning" and "structuring" while letting the features come out... FAST. It is, bar none, the best RAD environment I've yet worked with. Not that it's the best in every area, but that it clearly has the best balance between features and "gotchas". It has its weaknesses, such as lousy error reporting, but even that can be largely mitigated with a little intelligence in advance. But it really does have a number of key strengths that I leverage to the hilt:
1) Stability. It just doesn't die. Ever. I've never, ever, ever had a problem with PHP "not working". I don't troubleshoot it. It's there, it works, and I don't sweat it.
2) Scalability. It's "share nothing" approach makes clusting and random-host selection boil all the way down to a simple session manager. Having 1 or 10 application servers running side-by-side is almost trivial!
3) Code density = excellent! It's a fairly dense language, meaning that lots can get done in a few lines. Just for giggles, I've written a self-forking, multi-process daemon with a process manager and hundreds of managed children forks performing a deep-level network scan in like 50 lines!
4) Security. Yes, you heard me correctly. Although you can certainly use PHP "wrong", you can also use it "right". Once you do, you discover that PHP has a number of features that make things like SQL injection and shell parameter expansion a thing of the past. Really. Learn your tools!
5) Flexibility. You can run it as a module inside Apache. You can run it as a standalone executable. With tools like Ion Cube and PHP-GTK, you can create a cross-platform GUI application without revealing source.
6) Availability. Any $5/month web hosting company supports PHP, and there are many free ones, as well. You can download a CD, install Linux, and have PHP/Apache up and running in under 10 minutes. There are batrillzions of apps available A LA SourceForge for free. PHP is the most commonly available web development language. And, by no means is it a web-only development language!
Sorry you can't handle a few quirks in the function names. (so write out a file of wrapper functions - DUH!) Sorry that it's attempts to simplify variable management weren't perfect. Geez. Just code in c and be done with it, why don't you?
In short, PHP is everything that VB and
I have no problem with your religion until you decide it's reason to deprive others of the truth.
I think you would like to see netbeans:
http://php.netbeans.org/
Personally, I like things like integrated FTP, integrated subversion, integrated unit testing, and, most of all, an integrated server-side debugger w/ all expected function: breakpoint/play/step control, stack and heap manipulation, etc.
The debugger is the only thing I miss from a "real" IDE.
Subversion is garbage, of the "at least it's not CVS" variety. There are at least some ten or twenty distributed version control systems out there, at least one of which has got to work well for you.
FTP is garbage. Use anything else. Yes, anything else.
These are actually related. I don't really like most of the stuff you mentioned "integrated", as that usually means things like "I have a keyboard shortcut to run unit tests!" Great, but I'm comfortable on the commandline. Let me switch between my editor and terminal easily, and I'll run unit tests, run a development server, and anything else I feel like.
The other reason is that I can then switch to pretty much anything else without having to switch IDEs. I know just about everything is supported on Eclipse, but "just about" isn't everything. I don't have to choose between Git and Subversion -- I can use bzr, hg, darcs, or really whatever the fsck I want. I don't have to use FTP because it's got the prettiest interface -- I'm just as comfortable with scp -- or, when it makes sense, Capistrano -- I can even use things like KDE's fish GUI for ssh.
All of these are possible using a text editor, but you need 5 different applications
Yes, that's the Unix Way.
and none of it works together.
Wrong, wrong, WRONG!
All of it works very well together. On the occasions where it doesn't, I can hack together the glue require reasonably quickly, and be back to being as productive as I was before -- but these cases are also times when an IDE wouldn't be able to work with them at all, and I know a lot more about hacking together scripts (shell and similar) than I do about writing Eclipse plugins.
Not to mention: INTELLISENSE
Useless, unless it's linked to documentation. And then, still useless, compared to flipping over to my browser and asking Google, since I probably don't actually know what I want there.
Not that I would be against having it, but I'm not willing to fire up Eclipse (and burn all my RAM, and still have it be sloppy and inaccurate due to being a dynamic language) just for Intellisense.
And then there's workspace management, and keeping plugins in sync, and dealing with when plugins go bad -- can't start Eclipse until I figure out which plugin is making it crash, or, more likely, wipe it and reinstall from scratch -- and it'll autodetect the file as the wrong type, so now I have to go fuck with its filetype associations, and set keyboard shortcuts -- whoops, the shortcuts I want aren't there...
There's a whole new level of bullshit I'd have to deal with if I was using an IDE. I know, I was for awhile.
and DATA TYPE DISCOVERY! (on a loosely typed language that's a big help).
If I understand this, it might be a help if I had functions so massive I can actually lose track of a variable, or if you're talking about the whole built-in debugger feature.
Instead of having to basically memorize or manually lookup class names, method names, and method arguments, I just begin typing the class name, use some arrow keys, and be done w/ it.
Except that by the time I'm doing that, I probably want to know more about it. For example: Is this indexed from zero, or one? How do I create a has_many relationship with an order clause? Does that have to be a string, or can it also be some other cool data structure?
Let me know if you find an IDE that can handle Intellisense in Ruby and actually make me more productive.
Oh, also, a fair amount of what you're doing probably should fit in your head. If you're not doing PHP and needing to know things like mysql_real_
Don't thank God, thank a doctor!
echo htmlspecialchars($_GET['ekhm!']);
Better Unicode support, which is a major, desirable feature, as others pointed out, and as far as I know, magic_quotes won't be deprecated in 5.3. Just deprecating magic_quotes, the last piece of shit to get rid of (the other two were register_globals and safe_mode) justifies a new major version giving PHP a refreshed image. They finally got rid of three of the worst features ever thought in a programming language other than COBOL, FORTRAN, BASIC, RPG and similar crap.
Now they need to get rid of the fatal error on function redefinition or function not found stupidity (that was REALLY retarded, probably the single worst feature after the three I mentioned), lexical scoping, syntax for lambda-expressions, first-class functions, better garbage collection, true object-orientation, a decent class system (i.e. one that's not modelled after Java's), operator overloading, associative arrays with support for non-string keys, decent iterators which don't require you to define 235789051 methods - just one (next) as a minimum, generators, coroutines, threads, a decent eval without the return insanity, and functional programming tools. Oh, wait, they need Python!
On top of that, I'd get rid of statements (make all of them expressions), add guaranteed tail-call elimination and get rid of the dollar sign.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
How exactly is this insightful?
How about rebutting his points? They are actually quite valid in contrast with the the sea of PHP haters.
PHP has it's problems but it's quite well suited for a certain set of tasks.
There is a fine line between being a cultivated citizen and being someone else's crop. - A. J. Patrick Liszkie
2/10
If you think PHP is like C for the web, you haven't understood it correctly, and you're not using it to its potential, or even close. (And don't even get me started on porting real C/C++ code to PHP.)
Perl's native syntax for regex is the least of my concern with Perl's insane syntax. Reindentation is something you do in every language, regardless of if it's Perl or PHP, and you never reindent lines one by one, but use a decent editor that will allow you to select multiple lines and indent. PHP is not a real OOP language, and it has a poor class system modelled after Java's.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
One would thus wonder why the slashes are required, possibly messing up with variable regex.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
10/10 10/10 10/10, listen to this man, he knows what he's talking about.
You're the kind of person I like to work with.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
This is complete rubbish. Changing major versions often notifies of backwards incompatibility. Examples:
qt1 -> qt2 -> qt3 -> qt4
gtk1 -> gtk2
linux kernel v1 vs v2.
One can go on forever here...
...faggot.... Fuck you .... PHP sucks dick
Unlike the grandparent poster, you have clearly made the point that indeed it is YOU who are the clear and rational one.
There is a fine line between being a cultivated citizen and being someone else's crop. - A. J. Patrick Liszkie
They indicate where the regex starts and ends, since regexes can contain pretty much any character.
Caesar si viveret, ad remum dareris.
There is no opening { so a closing } is also unnecessary. PHP doesn't require a closing ?> tag as this is assumed when the file ends. Not specifying a closing ?> helps prevent additional whitespace which can cause initialization problems eg. "headers already sent" warnings.
Caesar si viveret, ad remum dareris.
Never attribute to Hanlon that which can be adequately attributed to Heinlein.
Each time I read that they're ditching safe_mode, I do a little happy dance and shed a tear of delight.
All the other stuff is great as well, but safemode has made the quality of my life significantly worse in the past.
I have discovered a truly remarkable sig which this post is too small to contain.
The cleaner way to handle that is to have a second, separate parameter for flags. (For example, that's what Python does.)
Sorry but... what are the "Web 2.0 builtins"? I saw none... or is it "goto"?
{{.sig}}
Well, of course. But they're useless. There's no need to indicate that if they can just start at the beginning of the string and end at the end of the string, since options can be specified inside the regex, or in a separate parameter. That's what I meant when I said I wonder why they're required - more like that I wonder why they made it so.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
I really despise this kind of post, where each sentence is torn apart and commented on separately; usually with a sarcastic and snotty tone to it. In my opinion, it's just high brow trolling and makes the poster look like a right dick.
This is silly. Yes, web developers use whatever they need to use. I _can_ use PHP if I have no other choice. But I _avoid_ it as often as I can. I've been programming in PHP for more than 10 years now and the size of the projects i've worked on vary from very trivial to monumental. PHP is _easy_. But only for easy stuff. Once your project starts to grow PHP becomes a horrifying mess.
What if you want to append a number to a string? Given that standard C doesn't support overloading, would you have to write a new *differently-named* method? It'd be a nuisance to have to keep track of all the different methods when (e.g.) PHP can simply do the whole lot using the '+' operator. it's a scripting language, it makes no sense to resemble C in any respect. Wrong; it makes perfect sense to use C-style syntax. That's almost certainly the most common syntax by far, used as it is in C++, Java, JavaScript, C# and many other languages.
Visual Basic's syntax is different, and I had to learn this all over again when I used it for the first time, because I'm used to C-influenced languages. The mental context switch required and my tendency to keep inadvertantly using C-style syntax (leading to syntax errors) is a PITA.
I wouldn't mind if the VB syntax was nice to begin with, but it's not. It's inelegant and clunky; probably not bad considering it was derived from BASIC, but still inelegant and clunky. It probably got that way because it mutated from BASICs MS-DOS/PC programmers were familiar with, carrying them along with it. However, if (like me) you're not already used to that flavour of BASIC and haven't even used BASIC for years, it's not easy to use at all. It's not even that much like the old BASICs I used to use. Though this is getting away from the main point...
There may be valid reasons for using a different syntax, but those should reflect underlying differences in the structure/approach of the language (even Perl syntax is somewhat C-flavoured in various respects). However, using a fundamentally different syntax just for the sake of it is a Bad Idea. PHP is easier to use because it has a C-derived syntax.
"Slashdot - News and Chat Sites Deviant". (Click "homepage" link above for details).
I think that putting code out on the web is something only for experienced developers. Sure, everybody and their brother wants to do it, but that doesn't mean it's a good idea. Putting out an application on the internet, where anybody else can access it is inherently complex. Especially when you have server side code that accesses a database. You can kind of think about programming as chemistry. Anybody can buy a little chemistry kit in the mall, that has been verified to not contain anything that will explode or corrode, but that doesn't mean that people we would assume they are safe using high concentration sulfuric acid. The same for programming. If you are just programming little desktop apps that will be used by a single person then that's not so bad. It's much harder to cause a problem with a program on somebody else's machine if that program isn't accessing the internet. Once the app moves online, everybody is affected when a vulnerability is found. You wouldn't want an amateur making gun powder, you wouldn't want an amateur putting code out on the web.
And yes, I did mean mysql_real_escape_string. I only use PHP for personal development, and haven't used that function for so long that I forgot what it was called. Much easier and less risky to use PDO with prepared queries. You can't accidentally forget to clean a string using that method.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
Eh. You'd advocate replacing: if (/something/) { ... } with: if (something) { ... } ?
:)
Similarly replacing: s/this/that/; with: sthisthat; Ok, that ones a bit obvious
Just to be clear, I'm referring to PCRE wrt perl, not PHP, so I guess this is off-topic.
Caesar si viveret, ad remum dareris.
My bad. You were referring to PHP in particular, not PCRE in general. Sorry about that. Please ignore.
Caesar si viveret, ad remum dareris.
I thought you were describing Javascript. Or perl. Isn't it funny how almost every modern scripting language has those features while PHP is a steaming turd?
What makes PHP nice is that, language-wise, it is basically C plus a subset of C++ wrapped up in a scripting language. Almost any code written in C (or C++ without templates/exceptions/other icky stuff) can be trivially ported to PHP by replacing the type names with "var" and adding dollar signs in the right places. (I'm exaggerating slightly, but not much.)
PHP5 can actually handle exceptions, and has your normal public, private, etc. modifiers available for class properties. The var syntax is only necessary in PHP4 and has only been retained for compatibility reasons. I would be in support of removing var in PHP6 if the developers so chose.
If Emacs's Ruby mode is anything like it's Python mode, then: Emacs.
1. Open a new file, /tmp/foo.py
2. Type import time
3. Type print ti then alt-/ to complete it to print time. OK, that's a weak example of symbol completion, but it'll serve for now.
4. Type a period to make that print time., then hit meta-tab. That brings up a list of completions of all the attributes of the time module. Type g and meta-tab again to complete it to time.gmtime.
5. Hit control-c control-f to get the "Describe symbol" prompt, which will default to whatever's under the cursor - time.gmtime in this case - and hit enter. Now you're reading the documentation for that function.
At some point, hit control-c control-c to run your program inside an embedded Python session. If it throws an error, hit control-x ` to go to the line in your program where the error occured.
OK, the keybindings probably aren't what you're used to (although they can be easily changed). Other than that, it supports every other feature you described.
Emacs isn't for everyone, but you owe it to yourself to at least try it.
Dewey, what part of this looks like authorities should be involved?
As an experienced PHP developer, who has many websites that I take care of - some of them are ecom sites I manage for relatives- but I didn't write them... this news is kind of a two edged sword for me.
While I'm glad to see some of the more blatant security problems being closed up, and the things that encourage sloppy programming being removed.... I'm not excited about having to go through many hundreds of files of code written by OTHER people, to fix some of these things. Really, what's so wrong about the short php tags? *sigh*
I know it has to be done though. But I just finished cleaning up these sites for PHP5 and mySQL5. Yes, I'm wining.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
somewhat clunky? The only thing less clunky would be writing out function code to a temporary file and then including it. Yet another example of PHP developers adding a "feature" without putting any thought into it or understanding why.
Do you even lift?
These aren't the 'roids you're looking for.
Give us a break. I don't know what your grudge is against PHP but statements like
"OO? Only recently."
betray your extreme bias. Php 5 has been out since 2004 with "all" OO features, while PHP4 (out since 2000) had "most" OO features. You really have no clue what you're talking about.
"Unicode is an industry-standard set of characters, character encoding, and encoding methodologies primarily aimed at enabling i18n and localization (i10n)."
Ha ha... Everybody knows that i10n is shorthand for "intoxication", not "localization"...
Bow-ties are cool.
Slashes are not required. PHP regexps can be contained within any character. '~blah~' is a valid regexp. I regularly use something over than /, simply because / makes it hell to work with pathnames and URLs. With PHP, you can pick whatever character isn't in your regexp. How do Perl people handle that? Repeated escaping?
As for why it needs any container, it's because '~blah~i' is a legal regexp also. Yes, that *could* be another parameter, but then what do you do with functions that take arrays of regexps?
If corporations are people, aren't stockholders guilty of slavery?
Then how do you handle something like preg_replace, which takes, optionally, an array of regexps, and you want some to be case insensitive, some to be greedy, etc?
If corporations are people, aren't stockholders guilty of slavery?
Well, I think he's talking about "OO" stuff like reflection, which is basically O"Oh shit, I did all this OO crap and polymorphism and all that jazz, and now I really wish I hadn't!"O.
Of course, again, not my point. My point (albeit poorly expressed) is that it shouldn't have been necessary to wrap your regexes in characters which then you can't use without backslashing, because it bites when you try to use dynamically generated regexes. It's an example of unbright design, since it only exists "cuz Perl had it" and to specify options which you could easily and far more cleanly provide in a separate parameter (also easier to introspect), and also had a way to set from within the regex. It's unwise to develop, maintain, document, teach and have to learn many different ways to do the same thing, especially if some of these ways only cause trouble.
As for what to do if a function needs an array of regex? Well, the natural answer would be to use the language's means for pairing or grouping elements, be it a LISP cons cell, a Python tuple, or a PHP array(). Failing that, there's the ability to change options from within regexes, too.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
Or Lua, or Ruby, or perhaps Smalltalk. And most definitely Scheme, which is a LISP born in the freaking 70s, over 30 years ago, from which most of these new languages are borrowing their most impressive features. (Some of these came from even older LISPs, of course.)
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
This attitude - that new versions of the language should always support everything the old versions supported - only makes sense if you assume that the initial design was perfectly sound to begin with.
Had PHP4 been perfectly designed, and perfectly well-suited to what people are now using PHP for, there wouldn't be any need to change it at all. But PHP isn't perfect. They've found ways to make it better. They could fork off a new project containing those changes - but PHP6 is more like PHP5 than not - and if they had to fork off every time they changed things around they'd have a lot of extraneous extra names for basically the same thing.
Also consider - how much time and effort might they have to put in to augmenting PHP6 to be fully backward-compatible, and to maintain that awkwardness - even in the face of new features that may flat-out contradict older policies in the language? How much work would have to be wasted just to make PHP6 a better PHP4 than PHP4 is?
If you wrote your code for PHP4, just keep running it on PHP4 until you're ready to port it.
Bow-ties are cool.
> mainly because it isn't a kitchen sink like Perl....
Perl on the other hand doesn't litter the global namespace with hundreds of functions. Most of perl's builtins, furthermore, follow a consistent naming convention and argument order, neither of which is true in PHP.
Done with slashdot, done with nerds, getting a life.
I vi, therefore I am. Interesting. So you type, "if (0){esc", find the end of the block, and type, "i}esc" to end it. Wouldn't it be nearly equally complex but more readable to type, "esc : startline, endline s/^/\/\//" and comment the section? You can easily uncomment it again later by using s/\/\///.
I forgot to point out the problem with manually indenting. Use this to auto-indent a block:
:start,finish s/^/\t/
There are a lot of valid points about the short comings of PHP, and how even it's design encourages bad programming practice. The same could be (and was) said about Basic, and Visual Basic (pre .net).
And while I certainly agree that there are "better" languages out there, the one area I strongly believe PHP excels in is ease of use. Why is that important, compared to things like elegance, speed, and security?
Well, because by the time need some of the things PHP lacks - you've already learned how to do quite a bit of programming and are well prepared to address it's short comings, or switch to a more appropriate language.
We *need* a language that can be picked up in a matter of hours to attract casual programmers. Not every program needs to be great, many just need barely work.
I teach "Introduction to PHP" at FIT, and the first thing I tell the students is that should not be such a course; because anyone who knows enough to have a need for PHP should also be comfortable enough to learn PHP through an online tutorial or book. But these students know barely anything - I have to teach them how to write HTML forms, and all about databases (including what databases are) before they can PHP to do any of the things they want it to do. It's only a four session class; but PHP is still easy enough that I can teach them everything they need to know to get started.
Most of them will use it to write little guest book type apps for their personal websites, that run slowly and have huge security holes. But they have neither the traffic to make performance an issue, nor valuable enough information to make hacking their sites remotely worth it. If they like doing that, they can either make use of pre-built PHP modules, or learn how to code things better. But they've started, and I believe that's a good thing.
Programmers used to bash Visual Basic all the time when I was coding in that, but it's tiny learning curve got an awful lot of companies started down the path of in house development that Visual C++ wouldn't have. And that created an awful lot of work for programmers.
It's great that Zend is addressing some of the PHP issues; but I'm glad they're not trying to turn it into Perl. We already have Perl, we don't need another.
I had heard that ereg has better portability. Why would they ax ereg?
No single raindrop believes it is to blame for the flood.
His points had the barest, most tenuous connection with reality. The proper responses are either shunning or mockery. I did not choose shunning.
how to invest, a novice's guide
I'll be happy when we can reliably use English, which includes words like "façade". I still get followups from recruiters who want to talk about my résumé. Isn't it the 21st century yet?
> With PHP, you can pick whatever character isn't in your regexp. How do Perl people handle that? Repeated escaping?
No, they handle it the same way that PHP people do; picking a character (or matching set) other than /
--I'm so big, my sig has its own sig.
-- See?
True but it still stands that a lot of is down to the coder and not the language. I'd hope most hosts monitor people's PHP usage to some extent. I know ages ago I got booted off a host for using someone's script which was deemed harmful which is probably why I took the time to learn a bit of the language myself shortly afterwards.
The language is by no means perfect and I prefer working with Java but it's still a nice quick to learn powerful language.
Thats GLib not C.
In your example GLib is doing all the work for you, so it's not a apples-to-apples comparison.
Try actually writing real C code yourself and see if you like realloc.
THEN try php and tell me it's "too much work".
2) A PHP4-style class is functionally a struct. A PHP5 class is a struct if you don't specifically set any members to private/protected. Assuming your struct doesn't have any private/protected members, which you can do in C++. What about function pointers? Yup, they're called 'callbacks' in PHP. http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback
How about you try a touch of research before publicly whinging about PHP's supposed faults?
It's not checking that those methods exist, it's *defining* them dynamically.
s = sprintf("%s%s%s%s%s",
;-)
string1,
string2,
string3,
string4,
string5);
What's so hard about that?
Does the name Pavlov ring a bell?
Neither of those words is English, and if you spoke English properly you'd call the second one a curriculum vitae. Er, wait...
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
When did the future switch from being a promise to a threat? -C. Palahniuk
Yup. That's the first thing I make darn sure is disabled when I set up a server.... And I've even been known to write code that explicitly tests for this being in use and refuses to run if it is just to avoid the bizarre user experience problems that invariably occur if you quote something that is already quoted.
Check out my sci-fi/humor trilogy at PatriotsBooks.
When you compile that code or when you run it?
Compile:
Incorrect pointer type in function call (argument 1).
Argument 1 discards qualifier (const) from pointer type.
Assignment makes pointer from integer without a cast.
This is from memory, so wording of error messages may be inexact.
Run:
Segmentation fault. Core dumped.
sprintf in C requires a variable of sufficient length to hold the printed content, e.g.
char str[2048]; ...);
sprintf(str, "%s%s%s...",
Perhaps you meant asprintf? Even still, your usage is wrong. It's:
char *str; ...);
saprintf(&str, "%s%s%s...",
Check out my sci-fi/humor trilogy at PatriotsBooks.
Python has proper lexical scoping, only you don't understand it. In Python, = is used to rebind variables. It's not Scheme's set!. If you use it, you obviously create local variables. And it works that way because = is also used to define a new variable. There's no Scheme's define, or JavaScript's var.
However, lexical scoping works as expected and defined in holy book SICP section 3.2, "The Environment Model of Evaluation". You can access variables defined in any lexically enclosing scopes anytime, and they can be shadowed. As in Scheme, these variables are bound to objects which can be modified, so you could, for example, mutate a list from an enclosing scope.
Whenever I need to reassign values to outer scopes, I box them with a list, creating them with box = [value] and setting them with box[0] = new_value, exactly like box and set-box! in Scheme. And if I need multiple values, a class to contain your arbitrary properties is an elegant solution.
Python 3000 will introduce the nonlocal declaration so that = works as a rebinder in the corresponding outer scope, much like Scheme's set!, and it'll come in handy, but you don't really need it to work.
I was about to say 13256278887989457651018865901401704640, but it appears this number is private property.
Funny that you're being pedantic about declaring the destination variable but not my assumptions about the source string1..5 variables.
and yeah, I used the PHP syntax for sprintf ironically. Sorry.
Still, it's not so hard to do "lots of concatenation" in C
btw, you mistyped asprintf in your 2nd example. you're welcome.
Does the name Pavlov ring a bell?
An IDE is not entirely useless. It's not impossible to make the perfect IDE. But for most projects, the IDE simply isn't worth the hassle that it brings.
Don't thank God, thank a doctor!
For one thing, there's just entirely too much in the way of syntax hacks. Take the "keyword arguments" which are actually hashes.
As far as I know, it's actually impossible for any editor to be able to complete this statement, without actually knowing how Rails works: Ok, sure, intellisense is nice if, for some strange reason, I forget what has_many is called.
But for the rest of it, you'd have to know that the second argument,
And then there's the rest of it, which is part of the options hash -- which means that it would have to know all the options which has_many can receive. But has_many is actually receiving a hash as an argument, and then doing something with it. As it happens, Rails has some fairly standard ways for a function to specify what it accepts as "keyword arguments", but again, you'd have to design that specifically for Rails.
Even given that, you'd have to know that
The one feature you've described that might be useful is a shortcut for getting to the documentation -- because we really would need a lot of documentation here. But that's not worth learning Emacs for, when I already have a keystroke to take me to my browser, where the Rails documentation is, and search "methods" for "has_many" -- which is probably already up anyway.
Oh, one more thing, while I'm at it -- Ruby lets you override method_missing, which is called when you try to call a nonexistent method. Rails uses this to pretend to have a lot of convenience methods on its associations. I've used it in some programs of my own -- creating a wrapper around an object, for instance.
I'm not sure if having intellisense which sort of works, sometimes, is better than not having it at all.
Maybe one day, there will be better Ruby editing tools. In the meantime, I find that the tradeoff is worth it -- that extra time spent looking up documentation is more than made up for by how quickly I can actually get things done once I know those methods.
And finally, just a nit -- meta is often mapped to alt, right? Meaning that meta-tab means alt-tab, which usually means something quite different in most window managers.
Don't thank God, thank a doctor!
The other thing to keep in mind is that the OO was tacked on, badly.
Contrast this with Perl OO, which was tacked on fairly well, and done in a Perl-ish way, so that if you already knew Perl, the OO would make sense to you.
Or with Python or Ruby -- Python was OO since the beginning, and Ruby is pervasively OO, in that absolutely everything can be coerced into some kind of an object, and you can call methods on it, or add some of your own.
Example: nil (null, really) is an object, and you can define your own methods on it. So are integers, and you can subclass Integer if you like. (The one drawback is that a lot of this expressive power can let you do evil, twisted things, that might make the interpreter crash badly, like attempting to define true as false and false as true.
My new favorite way of describing PHP is "training wheels without the bike."
Don't thank God, thank a doctor!
Well, the one advantage there is that it opens it inside Emacs, so you can copy-and-paste code samples without moving your hands. To each his own; it just works well for me.
Anyway, here's a screencast showing someone using Emacs with Ruby. I don't know Ruby enough to know if this is cool or pointless, but you're probably in a better-position to judge it.
And finally, just a nit -- meta is often mapped to alt, right? Meaning that meta-tab means alt-tab, which usually means something quite different in most window managers.That depends. I have it mapped to the Windows key on one keyboard, but escape-foo is exactly equal to metakey-foo in Emacs, so you can always get to those functions without hitting alt-tab. At any rate, you can remap any keybindings you want - that's just the default.
Dewey, what part of this looks like authorities should be involved?
Remember, three thousand reserved words. If you never hit them, you're lucky -- I'd rather not take my chances. I'd rather go with a language that has good, solid namespace support, baked into the standard library, from the beginning, so I never need to keep more than maybe twenty words in my head at a time. Not to mention TFA is about new features of PHP6 / 5.3, including namespaces. Yay! After 13 fucking years, you finally get namespaces!
Do any of PHP's competitors lack namespaces? Have they ever? Even Javascript has namespaces, or at least the constructs needed to build them. And PHP is finally getting them in 2008.
Who wants to bet how much of the core library is still going to be crapped over the global namespace? Maybe you can offer some proof that putting these functions in the core library adversely affects PHP's performance? It increases RAM usage, and is necessarily going to take more time to compile -- compile your program, that is -- at the very least. That's a given -- suggesting otherwise is like saying "Maybe you can offer some proof that putting a call to factorial(5000) in the middle of our view adversely affects our app's performance?"
Now, maybe if you said "significantly adversely affects performance"... Oh, and does PHP support structs? 1) Is there any reason I should care? This was in response to someone claiming a strength of PHP as being that you can copy/paste C code and only tweak it a little bit. If you don't support structs, that makes it a bit difficult. What about function pointers? Yup, they're called 'callbacks' in PHP. Ok... So you can create a function, given a name, and then pass that name around. And you pretend that's a function pointer? What?
So... That's going to add a lot of complexity for things like this: Admittedly, you can do this with a for loop -- provided you know it's actually an array you're dealing with. Iterators like 'each' are a lot more flexible.
It's also going to make some things actually impossible. How would you do this: I admit that, as written, these are contrived examples. That's because they're examples. This kind of stuff is useful in practice, and even JavaScript supports it.
But... you know what, never mind. Lack of support for closure scope means you could never do something like the above anyway.
Don't thank God, thank a doctor!
Market saturation?
D'oh! I got asprintf and snprintf mixed in a bad way.... :-)
Check out my sci-fi/humor trilogy at PatriotsBooks.
I would PHP into that category and move on. A lot of people have. There are much more pleasant environments to develop in, and you don't need all that much to generate 99.9% of the dynamic Web pages out there. (And heck, for that other 0.1% a better language is going to make it easier, even if it's not quite as turn-key.)
Thanks for the link. Bookmarked.
That's not what the PHP code does, though... so he's not comparing apples == apples.
Perhaps he's a better Ruby developer than PHP developer.
That's understandable, but it means that maybe he isn't qualified to issue judgment on PHP.
There's a load of security concerns when developing in PHP, but you can't tell me that's not the case with every language out there.
Who programs without security in mind in any language?
Fair enough, but take away Zed Shaw and we make the OBSD guys look like Teletubbies. Take away DHH and we're actually a downright loving community.
Don't thank God, thank a doctor!
A dick who got modded +5 insightful.
If you actually have a counterpoint, go ahead. If you think I took something out of context, show me where.
I really despise this kind of post, where no comment is actually made about the substance of a post, only about the way in which it was presented.
Don't thank God, thank a doctor!
That's really interesting. I wonder if it has anything to do with the release of ASP.NET v2.0?
After avoiding Microsoft web platforms like the plague for a decade, I recently took a new job and left the LAMP and Java/JSP world behind for ASP.NET and C#; and I'm amazingly productive on the new platform. I never used ASP.NET v1, but it looks like it was missing a lot of things that were added in version 2. I'd be willing to bet that with the release of v2.0 in 2005, Microsoft stole a big chunk of what would have been PHPs market share.
@ASP.NET's parent-teacher meeting: "Little Johnny.NET is very bright, but he doesn't play well with others."