An Early Look At What's Coming In PHP V6
IndioMan writes "In this article, learn about the new PHP V6 features in detail. Learn how it is easier to use, more secure, and more suitable for internationalization. New PHP V6 features include improved support for Unicode, clean-up of several functions, improved extensions, engine additions, changes to OO functions, and PHP additions."
Update — May 7th at 16:47 GMT by SS: IBM seems to have removed the article linked in the summary. Here's a different yet related article about the future of PHP, but it's a year old.
It's about time PHP has native support for unicode.
without wanting to be overly sarcastic..
What features are they gonne break this time?
All very good. But there is no set release date; I wonder when PHP 6 will be released?
They have been working on PHP 6 since at least 2005, and from monitoring announcement etc., I haven't seen any signs that they are nearing a release.
I am definitely no PHP expert so perhaps I am wrong but it seems that much of what is being changed is backtracking due to bad language decisions from the beginning. Sadly I think PHP developers with legacy code are going to be paying the price for several versions to come.
Play me online? Well you know that I'll beat you. If I ever meet you I'll "/sbin/shutdown -h now" you. -Weird Al, kinda.
are these ass clowns still planning on using \ for namespaces?
Do you even lift?
These aren't the 'roids you're looking for.
Given that PHP 6 was "rumored" to be out at least a year ago. I can't decide if the title "An Early Look" is meant to be ironic, or is just a sad indicator of progress.
Despite that, I would say that three things have recently happened demonstrating the improvement in quality of PHP:
I would say that (1) and (2) easily are more important for the language than is (3). PHP 5.3's improvements should be a huge change: Namespaces (I know there's a huge amount of hate for this implementation: get over it. It's going to be very useful), Closures / Lambda Functions, and Late Static Bindings in particular make it hard to wait so long for PHP 5.3.
So, stop talking about PHP 6! Lets get PHP 5.3 out.
clean-up of several functions
Does that include safe_quote_string_this_time_i_really_freaking_mean_it, or do_foo(needle, haystack) and foo_do(haystack, needle)? At least it gets namespaces after all this time, even if they're almost deliberately ugly.
Dewey, what part of this looks like authorities should be involved?
Like any other computer science problem, break it into pieces (think Divide and Conquer). Loading 88MB file into memory is not going to work by default anyhow, unless you set the memory limit in PHP from the default you will get out of memory errors every time. I think even a find/replace in a Windows app like Notepad or Notepad++ will "work" but it will definitely be slow. When I used to search large logs I would use some sort of file splitter and search each file itself.
-- Brought to you by Carl's JR
My items to fix: - Remove the "goto" statement that will be introduced in 5.3 (WHY JESUS, WHY??); - Stardandize function names (current samples: str_replace, html_ entity_ decode, htmlentities, htmlspecialchars_decode); - Improve array speed (for simple arrays, use internally one simple C array/list - current days, any array is a map); - Insert optional configurations by project (and not by host); - Remove function alias; - Provide optional typing for functions and parameters, but in a simple and consistent way (no strange notations); - Remove old extensions, like PDF paid extensions (and please, insert any open and official PDF extension); - As any language, provide a way of store compiled regex, avoiding compile them all the simple regex call for the same task; - Provide legacy support for PHP5 application as separated download (or at least allow PHP6 and 5 in the same host - we suffer a lot to find PHP5 Hosting in the earlier times, due the impossibility of run PHP4 and 5 at the same host).
So let's say you've got a global variable, $n
And let's say you're using it in a module, Foo
And because scattering global variables everywhere is a stupid idea that will lead to much pain, let's say you've decided to use namespaces in PHP6.
Now, in your main script, let's say you happen to be using a variable $Foo, for no particular reason.
What does this do?
<?php
echo "Hello $Foo\n";
?>
$x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
$x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
PHP5 and, soon 6, is pretty strong. PHP5 has a fairly proper inheritance and member visibility model and is truly reference based (i.e. $objX = $objY means, in PHP5, that they are reference to the same object instance... opposed to PHP4 where $objX = $objY made a FULL copy of the object to $objX). Not perfect, but not bad - the rest of the language/API needs a cleanup, which lookd like v6 will help address.
One of these things just doesn't belong
python:
myArray.append(myvalue)
ruby:
myArray.push(myvalue)
objective-c:
[myArray addObject: myvalue]
smalltalk:
myArray add: myvalue
PHP:
array_push($myarray, $myvalue)
In the finest tradition of PHP, they made Unicode behaviour dependent on a setting. Have these people learnt nothing from the past? magic_quotes anyone? Bleh. All languages have their warts, but the amount of bad design decisions in this one is just staggering.
Staying up to date is part of doing business. Would you use a cab that still used horses? Get on a steam train with open box carts?
While progress for progress sake can be overrated the simple fact is that we learn from mistakes and improve on the stuff we make. There comes a time when being conservative turns you into a technical ludite and as a tech company you got to ask yourself, is this worth it?
Is there a business in supplying coal for instance? Some people still heat their houses with it, but does that mean YOU as a business man have to run a business to supply them?
Ask yourself, how much time does it cost you to keep the people happy who want PHP4 and how much that same time could have earned you in business from PHP5 customers.
Go into your local shopping district and you can probably find stores that still cater to people who haven't moved on, who still do their shopping at the corner store. It is quit fun actually, but who would you rather be. The owner of a corner store struggling each day to pay the bills, or the founder of Albery Heyn, the corner store that made it big?
The hardest thing a good business man has to learn is to learn which customers to let go.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
they have actually turned off the register_globals feature (really this time it won't work). If you try to use it you get an error message that says RTFM (ERROR: ID-10-T)
"i lost my dignity on a slippery wiener"
Market share: PHP 50%, ASP 49%, rest perl.
When PHP and ASP don't totally dominate the job listings, please come back to me again. In the meantime I know which of the function calls pays for my food.
Oh and $array[] = $value;
Coding, you should learn it.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
Loading 88MB file into memory is not going to work by default anyhow, unless you set the memory limit in PHP from the default you will get out of memory errors every time. I think even a find/replace in a Windows app like Notepad or Notepad++ will "work" but it will definitely be slow. When I used to search large logs I would use some sort of file splitter and search each file itself.
And here the rest of us are grepping and sedding multi-gigabyte files without thinking twice. Seriously, what's your idea of a large file?
Dewey, what part of this looks like authorities should be involved?
I hate to say it, but this wouldn't be the first time on /. when an article was submitted with a link that was a year or more older and the article made it to the main page. Particularly since the article the GP linked to is a year old to the day.
I can only imagine the submitter/approver looked at the date, say May 6th, and went "OMG, that's today!!!111"
GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
If you want to process large files (or any large chunks of data such as blob columns) in PHP without loading the entire file into memory, look into streams.
Slay a dragon... over lunch!
PHP: its like fast food..
You know its bad for you...
You feel like crap after eating it...
But damnit, its right there, oh so conveniently located on the way to work, and sometimes a greasy cheeseburger just hits the spot, even though you know you'll pay for it later in heartburn and much later in high cholesterol and love handles, even though right now its really cheap on the wallet.
Its a guilty pleasure.
And while you're sucking down that greaseball burger, you see the local soup and salad restaraunt and think "next time, I'll eat right.."
But come the next day and you see that taco joint and..
-- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.
I would love to see JavaScript on the server side. It's already way more powerful than php5 with (superior) prototypal oo, higher order/first class functions and many other meta-programming abilities.
All it needs is some good libraries. There are people already working on this. Soon... soon.
here's the correct one: http://www.ibm.com/developerworks/opensource/library/os-php-future/
How good is the object oriented support in PHP these days?
Everyone involved with PHP pretty openly admits that PHP5's OO model is a direct ripoff of Java, so inheritance, abstracts, interfaces, and access modifiers work pretty much the same way as they do in Java. If you like Java's OO, you should be fine with PHP5's.
PHP5 has a fairly proper inheritance and member visibility model and is truly reference based (i.e. $objX = $objY means, in PHP5, that they are reference to the same object instance... opposed to PHP4 where $objX = $objY made a FULL copy of the object to $objX).
So they've got to the level of Java 1.0. Congratulations!
Oh, actually, sorry, they didn't, since there are still no namespaces. But there will be soon, and then it'll be at the level of Java 1.0. Once again, congratulations!