PHP 5.5.0 Released
New submitter irventu writes "The long-awaited PHP 5.5.0 has finally been released, bringing many new features and integrating Zend's recently open-sourced OPcache. With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands, Google recently announcing support for PHP in its App Engine and the current PHP renaissance is well underway. This is great news for the web's most popular scripting language."
The full list of new features is available at the Change Log, and the source code is at the download page.
I'm still waiting for a PHP 6.0 that's an actual rewrite without all the stupid. With every new version, I just see more features get tacked on ("Objects").
It's wonderfully backward compatible because nothing really gets removed in newer versoins, but it would be nice if the language could be made more pleasant to use.
I participated in beta release testing for 5.5 and I'm frustrated that it still has old bugs that cause segfaults that continue to go ignored by the maintainers. I even supplied the patch and submitted a Github pull request, but the maintainers continue to ignore it.
It's no fun having to keep our own custom patchsets for PHP just to keep it running properly.
I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
For Laravel?
Why u no Symfony?
With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands
Citation needed. Why does the summary contain this blurb which is not even relevant to the story. Me suspects that the submitter could be an advocate who just ceased on an opportunity to tell slashdot about his favorite PHP framework.
Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
You only need a peek to see this Laravel dubbed "PHP renaissance" does not even try to be statically safe. It's littered with pitfalls like writing your validators with strings, such as: "array('name' => array('required', 'min:5')), ...".
(It is possible to write statically typed validators, with clean syntax (depending on language) and you end up not loosing stuff like auto-completion, semantic checking by IDE etc. See for instance latest Scala PlayFramework and it's JSON validation, it is relatively easy to use, and syntax is surprisingly succinct taken the fact it's extremely type-safe.)
I guess that's when everyone gathers around dressed in renaissance costumes, drink warm beer, speak in mock-British accents, and reminisce on the times when knights were bold and PHP was cool
With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands
Citation please.
Why the hell would anyone choose so insane technology for new applications written from scratch? We should let PHP die in peace.
It's pretty simple. There are people who learned most of their written language from written word, and there are people who learned most of their written language from spoken word. The person above is the latter.
Is for someone to write a new standard API that can sit in parallel to their old one that gives us sanity like string manipulation functions with real names and consistent parameters. You know stuff like:
$x = string::indexOf($source, $needle);
and
$x = string::replaceAll($source, $needle, $regularExpression);
CodeIgnitor? Maybe. RoR? Um, no. Or, perhaps, in your dreams.
As an RoR developer who left PHP years ago I assure you - we aren't just waiting for a really good PHP framework that's an RoR knockoff. Part of the greatness of Rails is Ruby, and looking through the Laravel docs just confirms that. It looks like Laravel is about as nice as you can get on PHP, but ultimately it's still PHP underneath (and on top).
Rails is a meta-language built on top of Ruby. Just can't do that in PHP.
And that's not even getting into the ugliness of PHP's cruft that's been built up over the years.
Do you have ESP?
Yes it has its flaws, yes you sometimes don't know whether you're looking for needles in haystacks or haystacks in needles, but it's not like they're not aware of that, and it's not really a big deal either in these days of syntax and function aware editors and instant online reference, and it has provided me and i'm sure many thousands of other people with a career not just in contract coding but also in being used almost exclusively on our own websites.
Thanks guys!
All of the complete and utter shit that is the language called PHP and that is your argument against it?
Yeesh.
Yes, why NOT rewrite the entire language tokenizer for vague reasons of potentially avoiding a single keystroke?
It's better to vote for what you want and not get it than to vote for what you don't want and get it.
- E. Debs
Taken a quick view at Laravel, it's again a framework like one in a dozen.
All such PHP projects can be divided into to groups: frameworks and CMS-es. A big problem with all those PHP frameworks is that you have to write stuff like user administration, authentication, static pages from the database, etc yourself. In my opinion, in many cases the MVC architecture is not implemented in a clean way and it's often too complex to translate an URL to an actual file on disk.
A big problem with most CMS-es (like Wordpress, Joomla and TYPO3) is that it's one big chunk of code. There is no clear separate framework layer. It's quite a torture to add or change functionality by writing code. And don't even get me started about security!
That's why I wrote the Banshee PHP framework. Clear MVC implementation, easy routing, strong focus on security and clear separation between framework layer and CMS. Clear the controller, model, view and css directory and what's left is the framework. Although I call it a framework, it's more of a framework / CMS hybrid.
It is not my intention to spam about my framework, but I realize this post can be seen as such. Sorry for that. I only want PHP developers to know there is more than those minimalist frameworks or bloated CMS-es.
It doesn't have to be like this. All we need to do is make sure we keep talking.
I have two guilty pleasures: Watching the show COPS, and programming in PHP.
I dream about getting away from PHP and occasionally dip my toes in other waters (Python, Java, and even C++) but always come back to PHP. I won't go to Ruby for as many websites start with Ruby and then abandon it for many other languages. People blah blah about MVC but often what I am doing is just too damn simple to need such added complexity. I might need a program that I occasionally run to view a list of spam flagged submissions; it is done in 10 minutes in PHP. I don't use any frameworks and am diligent enough to keep things running through prepared statements and whatnot. With opcode caching and memory caching of data PHP is very very fast.
It is not so much that PHP is the best at anything it is that it isn't really terrible at anything I care about. Almost every other language is terrible at at least one thing that I do care about.
Personally I think that PHP gets its bad rap because it is a very easy transition from HTML. So you have basically non programmers starting to sprinkle PHP into their HTML and oddly enough an untrained programmer's first efforts end up being crap. Then because PHP covers all the web server basics these programmers potentially never venture beyond PHP and there is nothing better for making a bad programmer than a one language programmer. (Not someone who primarily programs in one language but one who only ever learned the one language) So these same programmers keep expanding the scope of their terrible code.
So if anyone can suggest a programming language to replace PHP I would love to know (and all JVM languages are off my list).
You know a vast majority of them are not needed? Have you ever written a parser? I could see these things helping a lexer a great deal.
The CPython folks constantly moan about parser complexity, and even they managed it.
Yah, they were really great in BASIC!
There are a lot of languages with similar syntax that handle variables without special markers quite well. It's not like writing parsers is some arcane craft, it's a long ago researched topic in CS and covered nicely in first chapters of any compiler construction textbook.
Well, it may be an arcane craft for PHP authors - I mean, function_returning_an_object()[index] was a parser error until not so long ago and you had to do temp = function_etc(); ... temp[index];
Tells a lot about PHP "design", just like it getting try...finally in this version almost 20 years after first version (and with team getting bugged about it for most of this time).
escape_string_no_we_mean_it_this_time_why_are_you_laughing_v2
My rule of thumb is that if the escape function is a method of a database connection object, such as the $conn->escape_string() of MySQLi, it's the real deal. But most of the time, I just use prepared statements, reserving manual escaping for things like the right side of operator IN that would need a large, variable number of placeholders.
All of the complete and utter shit that is the language called PHP and that is your argument against it?
To be honest, that's the one thing that has the most frequent impact on me -- yes.
There's a lot of other things wrong with the language, but I would have to say that the ever-present unnecessary noise of the dollar signs is the one that impacts me on a continual basis.
The PHP Renaissance is here and it looks just like PHP from five years ago. The router in Laravel interacts directly with the models for setting up request vars? Doesn't anyone else think that's idiotic? Shouldn't the router focus predominantly on routing? Shouldn't you drive state into the controller? Or does Laravel just follow the typical PHP approach to making everything in your app fat for the sake of keeping the developers dumb?
If this is a PHP renaissance I'll keep using Ruby, or pretty much anything else.
Yes, why NOT rewrite the entire language tokenizer for vague reasons of potentially avoiding a single keystroke?
It's not a rewrite of the entire language. I would be a relatively small, backward-compatible change. (The $ would still be required inside of a string.)
And it's avoiding a single keystroke OVER AND OVER AND OVER on every single variable. I find PHP to significantly more tiring to type in because of it.
And it's solving a readability problem by eliminating continual, unnecessary noise. Very few other language require dollar signs -- there's a reason for that.
You know a vast majority of them are not needed? Have you ever written a parser?
Yes, about 8 of them over my career. (I used to work on compilers, specializing in parsers.) I've analyzed this enough to know that the dollar signs are unneeded, if used outside of strings. The parsing solutions would be the standard ones used in other languages -- for example, if the identifier is followed by a "(" then it's a function call. The symbol table knows the difference between a constant and a variable, so the protection of constants can still be supported. Etc., etc.
Why drive nails with a screwdriver when you could use a hammer instead?
Because hosting plans, especially budget shared hosting plans, are more likely to come with a screwdriver than with the particular version of a hammer that your application needs. You could have the best web app in the world written in Perl or Python, but you'll pay more to run it than you might on PHP-only hosting. MySQL is popular for the same reason: ubiquity on entry-level hosting.
Given that I've seen exactly zero PHP programs running as scripts outside of a webserver environment, I'm calling bullshit on the idea of PHP being a scripting language, let alone "the web's most popular" one.
Dewey, what part of this looks like authorities should be involved?
if token.type == TOKEN_TYPE_STRING {
if keywords.contains( token.value ) {
handle_keyword(token);
} else {
handle_variable(token);
}
}
There are 0x40000000 types of people: those who understand 32-bit IEEE 754 floating point, and those who don't.
Being stuck developing on other peoples servers.
One thing I found very strange was how much it matters. It is surprising how many necessary, basic features have just been added.
Troll is not a replacement for I disagree.
I would be a relatively small, backward-compatible change.
You would not be a small backward-compatible change. echo foo; has a meaning in PHP -- it will, with a warning, echo the string 'foo'. Granted, that's stupid as hell, but it means you can't drop '$' in a backwards compatible way.
The '$' has some advantages. The syntax is consistent with variable expansion in strings. Variable names don't conflict with keywords. Variable names don't conflict with functions (and boy, do the PHP devs ever love adding functions, right into the global namespace.) It stands out when embedded in HTML. It lets you do the terrible '$$a' double dereference. It separates variables from constants, which are replaced with their value at compile time.
Comment removed based on user account deletion
Really, the quality of PHP depends on the person writing it. Bad code is bad code in any language, PHP does not cause you to write bad code, the problem is you! PHP is the most popular scripting language, most servers support and more importantly, there is a ton of documentation and examples about. I really can't see why people hate it so much, I guess we are probably looking at some form of Fanboi war, apple vs m$ type bullshit. There are many ways to skin a cat (in regards to programming) with PHP being probably the most inexpensive way to achieve what you need to do on the server side. It is either this or use one of the "cool" languages and pay more... whatever
Yes, we should go back to writing programming language that are easy for the compiler guys to do.
Optimization is hard. We should just leave that out too.
im guessing javascript somehow doesn't qualify? lol
The biggest PHP problems mentioned I agree with:
1. The way errors don't always trigger exceptions is completely wrong and I guess it's because of the way things evolved. It's a pain, and at the moment you have to deal with it. It's not beautiful, but it's not the end of the world either
2. Type coercion is not natural in many cases but I'm not sure if it just hasn't been thought through, or if it's a natural conclusion of starting with "0" == FALSE, which is *very* handy. Maybe someone else can help answer this
(Type coercion should be one of the first lessons in PHP, that way it at least sounds familiar if you ever run into the problem).
Regarding the renaissance thanks to Lavarel, I don't buy it. The article reads almost like a press release.
This is a pet peeve of mine and the following is quite ranty, but I wrote it to a friend and I thought it might be useful to get some feedback from readers here: why does everyone think that MVC frameworks are the right solution? I really only see two advantages:
1. It makes you organise your code in a certain way
2. You don't have to deal with mod_rewrite
The first point you should already have under control. You don't need a framework to keep things tidy. Why would I rather do regular PHP and keep things tidy myself? Because frameworks have you relearn everything you already know, and included in the extra layer of code there are all these assumptions that the framework authors thought were neat but which you only learn by hitting obstacles.
And if you really need a better solution than mod_rewrite, write your own, it's easy. And you don't even have to have it read from a configuration file: the mapping can be in source code.
Am I being narrow-minded? I've worked with Java for a number of years, mostly in web projects (Struts 1) or back-end code (connecting to DBs, services). I spent a summer designing a project to use Struts 2 and Spring (around 2008), and I've written my own MVC for PHP. I've tried CodeIgniter. And all this has just made me abhor MVC frameworks:
- The ORMs that we've known for decades cannot ever work
- The huge amounts of configuration files that people think exist because one day a client will request a change and all we'll have to do is change a few lines of configuration (like magic)
- The complete bewilderment when things go wrong (crappy or no error messages)
- The code generation
- Form handling and validations that are never quite right
- Poor documentation
Ruby or Python might be better than PHP, but surely MVC frameworks are not the solution.
Am I missing something?
"The language is as good as the developer using it" is a faulty argument. Read PHP: A Fractal of Bad Design for a good rebuttal.
Bít, zabít, jen proto, ze su liska!
Comment removed based on user account deletion
haha. i hate testing IA64.quite freakin unstable. sure people nowdays tough their pc is 64bit while it's actually ain't.
"The language is as good as the developer using it" is a faulty argument. Read PHP: A Fractal of Bad Design for a painful, pedantic and tedious rebuttal.
TFTFY
I am using the Ubuntu distro, how do I install it?
"The language is as good as the developer using it."
Exactly.
That's why PHP only has bad developers.
To be fair, one of the arguments for dynamic languages is less code needs typing because type conversion is handled automatically (some of the time).
With PHP all that's undone by the fact you're typing unnecessary extra $ signs everywhere and having to use === instead of == half the time. If you've got those extra keystrokes all the time then what exactly is PHP's advantage again? It doesn't have any.
So there is a fair argument against it even if it was a single keystroke (it's not, it's a shift+keystroke).
class functor { void operator() { } } n; n(); Is n a variable or a function? how about int n(5); A nice little constructor call. Love the most vexing parse. I believe using a $ would simplify a design, but not still not necessary.
Is it a variable or is it a function call?
I am not talking about going back, I am talking about them simplifying a design that already exists. I would not write a compiler personally that needed it.
I do love the "design" in quotation marks, they actually thought using a left associative ?: is acceptable? I think they are mad.
I like the $ signs, and I don't find them to be any impediment to typing or reading code.
I learned BASIC back in high school, and when I learned C it always felt strange to me to have "naked" identifiers everywhere, not to mention the confusing dual use of '*' and '&' operators.
If I were designing my own programming language, I would use this system:
foo : identifier for variable or object
@foo : address of foo's contents
$foo : value of foo's contents