Sudheer writes "The PHP development team is proud to announce the immediate release of PHP 5.3.0. This release is a major improvement in the 5.X series, which includes a large number of new features and bug fixes. Some of the key new features include: namespaces, late static binding, closures, optional garbage collection for cyclic references, new extensions (like ext/phar, ext/intl and ext/fileinfo), over 140 bug fixes and much more."
GOTO has its uses. I never used it (as I prefer a more structured way to code), but critical mission error handling may take advantage of a more direct way to "jump".
Anyway, one excepcional addition to the language is closures [php.net]. Real anonymous functions were missing for a long time on the language, and it is great to have it now.
Now it is only a matter of our customers' hosting providers to update their versions of PHP. Oh, well, considering most just migrated from PHP 4 to 5 (thanks to the EOL last year
GOTO has its uses. I never used it (as I prefer a more structured way to code), but critical mission error handling may take advantage of a more direct way to "jump".
I didn't said "exception handling", but "error handling", like linux kernel developers [kerneltrap.org] use.
Anyway, exceptions in languages like Java which enforces its treatment in compile time are more than just a "goto error handling". It all depends on the language you are using.
Say what you will about PHP, but it puts food on my table and a good roof over my head. I have been clamoring for the new features in PHP 5.3.0 (closures, namespaces, they finally killed register_globals) and can't wait for the improvements coming in 6.
I truly appreciate the hard work of the PHP development team and the free language they have given us, congratulations on the new release.
Hallelujah on the register_globals. At least magic quotes are now deprecated. Here's looking forward to 6.0 when they are finally removed!! (I've talked to way too many devs who think they are adequate protection against SQL injections)
I don't know VB that well, but PHP has plenty of genuine headaches within it: http://www.tnx.nl/php.html [www.tnx.nl]
So yes, while you can write decent programs in PHP, most good programmers (i.e. the ones who understand the problems) don't want to. Even accounting for good programmers who don't have a choice, you end up with a disproportionate amount of the underskilled in the remainder.
No, no no. PHP is the "new COBOL". It's a horrible language, but it's built up too much inertia to get rid of it or most of its backward-compatibility disasters.
If you want the new VB take a look at Ruby - a language that lets you bring any webserver to its knees in only 5 minutes and 10* lines of code, no experience required.
1) *Every* language has its tards, 2) Ruby is on par with PHP speed-wise, 3) Ruby does have certain strange features, like name resolution order (never wrapped my brain around that), but that hardly affects how a language *looks* like. 'Nuff said.
So does this mean I should upgrade from PHP 3.2? Are there any incompatibilities with my existing code?
Maybe someone can look over my login script and tell me if this will work in PHP5?
$query_login="select * FROM user";
$result_login = mysql_query($query_login) or die("Your passwrod is might be bad I think"); //$login_check = mysql_num_rows($result_login);
while($row=mysql_fetch_array($result_login))
{
$username=$row["username"];
if ($username==$username1)
{
echo "";
echo "window.location.href='login_error.php?rec=qq';";
echo "";
exit;
}
}
The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!
Looking at the "what's new" list I see the cool new feature of php archives..phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?
The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!
Looking at the "what's new" list I see the cool new feature of php archives..phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?" Seems like include normally just inserts the included file into the current source code as if it was there to begin with, no? I guess in the past without namespaces that's probably what most people needed most of the time. And after converting my development wholesale to python with it's inherent namespaces (which are really just singleton objects bound to a local name), it seems like PHP's system is a bit convoluted.
In a nicely made OOP application, you should never have to explicitly use require/include and instead use a class autoloader.
Let's say you've been using PHP since about a month after Rasmus released it 15 years back, so you've got a whole lot of code that uses the ereg family of regex functions. So they've depricated them, and plan to yank them from PHP 6. Why? Is the overhead so terrible? Or do they really think that it will improve our lives if we have to go back through everything and translate eregs to pregs?
Then there's the change in MySQL password formats. Sure, if they include the latest MySQL libraries they have a differe
There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this? When 5.3 rolls out through the distros a whole lot of MySQL backends will fail on the password thing. And when 6.0 rolls out millions of regexs will suddenly be failing. Needlessly.
Given the current state of the economy, this is how you can help keep PHP programmers employed... and why you have a test environment where you install new stuff like this before deploying it across your platforms... so you can find all of the pitfalls, traps, changes, etc, without causing your site to fall down and go boom.
They've been talking about these changes for a long, long time. If you're still using ereg, or register globals, or magic quotes, or whatever else you want to complain about them changing, then that's your problem. If you have important code laying around that you haven't looked through yet, you might want to pencil that in. There's no reason to have PHP4-only code sitting around these days.
Change is almost always painful and scary but you'll be happy for it in the end. Update the code and be glad they don't stay backwards compatable to every iteration of the language.
It's better to clean up and remove the old stuff and continue improving the language. They don't have enough resources to bugfix and improve such a lengthy/aging codebase.
There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this? When 5.3 rolls out through the distros a whole lot of MySQL backends will fail on the password thing. And when 6.0 rolls out millions of regexs will suddenly be failing.
Uh, no.
Assuming that people running and maintaining the code are paying any attention, when 6.0 rolls out, those installations that have work
There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this?
Nothing is broken. Ereg is moved to the 'official' extension pack called PECL, which you can use for full backwards compatibility. At the same time the community has been warning not to use the ereg functions for the past at least 3-4 years, if not more, citing worse performance, worse featureset, and the possibility of PCRE replacing it at some point in the future.
They really think having regex functions that aren't binary safe is a bad idea -- besides the obviously disastrous results when used for input validation it also means that ereg cannot support unicode. Plus it's just extra code that there's little reason to continue patching and porting a decade after it has been superseded by faster, safer functions.
I don't think that's quite fair. I think if the functions, calling conventions and naming were regularized, it would be a reasonably decent scripting language. But it's because it suffers multiple personality disorder that it's a horrendous pain.
I think if the functions, calling conventions and naming were regularized
...and they removed the sigils, and removed the silent type coercion, and eliminated the "@" function prefix, and removed the "global" keyword, and removed the weird "list" lvalue function that looks-like-functional-pattern-matching-but-really-just-cosmetically, and fixed the pass-by-reference semantic...
But if you did all of these things, it really wouldn't be PHP anymore.
Oh wait, almost any PHP project eventually gets reduced to a song and dance of ugly hacks.
*sigh* Yes, yes, we know, and Python or insert-your-pet-language-here is a gloriously clean and not-at-all counterintuitive* wonderland of fantasy and enchantment where fairies and elves smile upon you and give you their blessings and unicorns piss rainbows and shit candy.
At least until the next hip, trendy language comes out. How's your Ruby on Rails coding coming along?
*: Obviously, because if anyone finds it counterintuitive and an ugly hack, they are wrong and ugly and stupid and smell funny so there.
I use php and do enjoy it but it is ugly. There is no consistency within the function naming, using -> over . Or any other single symbol is dumb and __construct() but why two underscores? It's unnessary.
__construct() is a magic method, just like __get(), __set(), __destruct(), __isset(), __toString(), so on and so forth. Magic methods are called without the programmer having to call them, under specific circumstances. In the case of __construct(), it's called when an object is instantiated. '__' defines a magic method and was chosen back in the day because PHP didn't have protected/private members and so the common practice was to prefix private/protected members with one underscore.
PHP was a solution to Perl, so -> is what Perl uses so that's what PHP uses.
The function naming is not so much an issue either. But what is frustrating is argument order. That's something that really needs to be revamped, backwards compatibility be damned.
It's funny how people cling to languages for arbitrary and sometimes downright illogical reasons. It's like each language is cool or acceptable in various online social circles. In fact, they can be broken down into their equivalent high school archetype:
PHP - The Slackers
.NET - The Jocks
C - The Goths/Hardcore
Ruby - The Hipsters
Haskell - The Nerds
Java - The drifters
In seriousness, I'm with the OP. I wish the ridiculous language evangelism would stop. In the end, people are just being short si
What am I, as a Schemer? A minimalist? A chess player [mit.edu]? But seriously, I always saw PHP as one of the prime examples of cargo cult language design. "Perl has strings in front of variables, let's copy them, gods will be pleased." Obviously no one cared that in Perl, the sigil has some actual meaning, like in shell, unlike in PHP, where the single type of variables could be handled the same way it is handled in Python, Ruby, stc. And then the adoption of that strange Java-like OOP system, quite weird for a dyn
Every language has its strengths, weaknesses, glaringly awful bits, shiningly wonderful bits, and all of the subculture that go with those things. No language is perfect or even acceptable for every job.
PHP is an extremely organic language. It is the result of hundreds of developers' efforts and the inclusion of many modules that were once addons.
I've been using it since very early version 3.0, so I know why things are named the way they are. That doesn't make them
PHP as I told a manager is useful because it is ubiquitous, not because it is perfect or even particularly good. At the time I worked on a derivative of GForge, which is a definite example of the horrors that can come from PHP projects.
This is also an original quote by me: "The beauty of PHP is that it is so simple even an idiot can program with it. The problem with PHP is that so many idiots do choose to program in it."
In my own hosting, I have the choice of using RoR, but the app must be manually redeploy
5.3 should be cool, now I just need to start pestering my hosting providers about upgrading.
Dude, dedicated server!
I also always pick PHP because its so nice to code with it and because of the box it provides so many different functions from many areas. It saves you lots of time and work if you dont need to always write your own functions for everything or google for a library. This is also why I prefer Delphi over C++.
Everything changed with the release of Drupal (written in PHP). We are creating several large projects each year based on Drupal/PHP and our solutions easily bests any proprietary solutions I've encountered so far.
Separation of concerns is a concept in *all* schools of software design. Only retards think that it was OOP that brought us namespaces, modularity, exceptions, polymorphism and things like that.
features! (Score:2, Informative)
PHP now comes with more GOTO!
Re:features! (Score:5, Funny)
Parent
Re: (Score:2)
hahaha, thanks for that! I can't believe they put that in the official manual. Too awesome
Re: (Score:3, Insightful)
Re: (Score:2)
Like tail calls instead of gotos? ;-)
Re:features! (Score:4, Insightful)
Anyway, exceptions in languages like Java which enforces its treatment in compile time are more than just a "goto error handling". It all depends on the language you are using.
Parent
Re:features! (Score:4, Funny)
Parent
Re: (Score:2)
Re: (Score:2)
Where ever you go, there you are.
Re: (Score:2)
Looking Forward To It (Score:5, Insightful)
I truly appreciate the hard work of the PHP development team and the free language they have given us, congratulations on the new release.
Re: (Score:2)
Hallelujah on the register_globals. At least magic quotes are now deprecated. Here's looking forward to 6.0 when they are finally removed!! (I've talked to way too many devs who think they are adequate protection against SQL injections)
Re: (Score:2)
So yes, while you can write decent programs in PHP, most good programmers (i.e. the ones who understand the problems) don't want to. Even accounting for good programmers who don't have a choice, you end up with a disproportionate amount of the underskilled in the remainder.
Re: (Score:2, Insightful)
No, no no. PHP is the "new COBOL". It's a horrible language, but it's built up too much inertia to get rid of it or most of its backward-compatibility disasters.
If you want the new VB take a look at Ruby - a language that lets you bring any webserver to its knees in only 5 minutes and 10* lines of code, no experience required.
*plus 800000 lines of framework
Re: (Score:2)
Horray (Score:5, Funny)
Maybe someone can look over my login script and tell me if this will work in PHP5?
$query_login="select * FROM user";
$result_login = mysql_query($query_login) or die("Your passwrod is might be bad I think");
while($row=mysql_fetch_array($result_login))
{
$username=$row["username"];
if ($username==$username1)
{
echo "";
echo "window.location.href='login_error.php?rec=qq';";
echo "";
exit;
}
}
Re: (Score:2)
STAY AWAY FROM THE KEYBOARD RIGHT NOW!! That's it, easy, let go... That's all gonna be alright... (Pst! Somebody call 911..)
Re:Horray (Score:5, Funny)
If you can't tell that the parent post is a joke you're probably a PHP programmer.
Parent
Re: (Score:2, Funny)
Don't get your hopes up... I've seen real code that's worse.
My best feature... (Score:3, Funny)
...is the ability to employ goto, though it is not allowed to jump into a loop or switch statement. A fatal error is issued in such cases.
Re: (Score:3, Funny)
so it's goto, but not as we know it?
new features in php 5.3 (Score:2, Informative)
Re:new features in php 5.3 (Score:5, Informative)
You can also read the official release announcement instead of some random guy's blog.
http://php.net/releases/5_3_0.php [php.net]
Parent
Re: (Score:2)
The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!
Looking at the "what's new" list I see the cool new feature of php archives. .phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?
Re: (Score:2)
The backslash name separator looks awful to me, although I've always found PHP code kind of garish with all the dollar signs and curly braces. Although it's at least readable compared to some perl I've seen!
Looking at the "what's new" list I see the cool new feature of php archives. .phar files are zips or tarballs that can be included all at once in your program. Seeing that brings up something I've always struggled with in PHP. When should one use "include," "include_once," "require," or "require_once?" Seems like include normally just inserts the included file into the current source code as if it was there to begin with, no? I guess in the past without namespaces that's probably what most people needed most of the time. And after converting my development wholesale to python with it's inherent namespaces (which are really just singleton objects bound to a local name), it seems like PHP's system is a bit convoluted.
In a nicely made OOP application, you should never have to explicitly use require/include and instead use a class autoloader.
Nuisances (Score:2)
Let's say you've been using PHP since about a month after Rasmus released it 15 years back, so you've got a whole lot of code that uses the ereg family of regex functions. So they've depricated them, and plan to yank them from PHP 6. Why? Is the overhead so terrible? Or do they really think that it will improve our lives if we have to go back through everything and translate eregs to pregs?
Then there's the change in MySQL password formats. Sure, if they include the latest MySQL libraries they have a differe
Re: (Score:2)
There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this? When 5.3 rolls out through the distros a whole lot of MySQL backends will fail on the password thing. And when 6.0 rolls out millions of regexs will suddenly be failing. Needlessly.
Given the current state of the economy, this is how you can help keep PHP programmers employed... and why you have a test environment where you install new stuff like this before deploying it across your platforms... so you can find all of the pitfalls, traps, changes, etc, without causing your site to fall down and go boom.
Re: (Score:2)
They've been talking about these changes for a long, long time. If you're still using ereg, or register globals, or magic quotes, or whatever else you want to complain about them changing, then that's your problem. If you have important code laying around that you haven't looked through yet, you might want to pencil that in. There's no reason to have PHP4-only code sitting around these days.
Re: (Score:2)
Change is almost always painful and scary but you'll be happy for it in the end. Update the code and be glad they don't stay backwards compatable to every iteration of the language.
It's better to clean up and remove the old stuff and continue improving the language. They don't have enough resources to bugfix and improve such a lengthy/aging codebase.
Re: (Score:3, Insightful)
Uh, no.
Assuming that people running and maintaining the code are paying any attention, when 6.0 rolls out, those installations that have work
Re:Nuisances (Score:4, Informative)
There's a huge codebase out there that's using PHP against MySQL, and using PHP's original ereg regex syntax instead of the Perl-wannabe stuff. What are they thinking, when they set out to break this?
Nothing is broken. Ereg is moved to the 'official' extension pack called PECL, which you can use for full backwards compatibility. At the same time the community has been warning not to use the ereg functions for the past at least 3-4 years, if not more, citing worse performance, worse featureset, and the possibility of PCRE replacing it at some point in the future.
Parent
Re: (Score:2)
me first .. :) (Score:2)
Re: (Score:3, Insightful)
I don't think that's quite fair. I think if the functions, calling conventions and naming were regularized, it would be a reasonably decent scripting language. But it's because it suffers multiple personality disorder that it's a horrendous pain.
Re:Would you let it die already? (Score:5, Insightful)
I think if the functions, calling conventions and naming were regularized
...and they removed the sigils, and removed the silent type coercion, and eliminated the "@" function prefix, and removed the "global" keyword, and removed the weird "list" lvalue function that looks-like-functional-pattern-matching-but-really-just-cosmetically, and fixed the pass-by-reference semantic...
But if you did all of these things, it really wouldn't be PHP anymore.
Parent
It's true! (Score:2)
Years of php programming have danaged my bain to!
Re: (Score:2, Funny)
Oh wait, almost any PHP project eventually gets reduced to a song and dance of ugly hacks.
*sigh* Yes, yes, we know, and Python or insert-your-pet-language-here is a gloriously clean and not-at-all counterintuitive* wonderland of fantasy and enchantment where fairies and elves smile upon you and give you their blessings and unicorns piss rainbows and shit candy.
At least until the next hip, trendy language comes out. How's your Ruby on Rails coding coming along?
*: Obviously, because if anyone finds it counterintuitive and an ugly hack, they are wrong and ugly and stupid and smell funny so there.
Re: (Score:2, Troll)
Re:Hooray fileinfo is standard! (Score:4, Insightful)
__construct() is a magic method, just like __get(), __set(), __destruct(), __isset(), __toString(), so on and so forth. Magic methods are called without the programmer having to call them, under specific circumstances. In the case of __construct(), it's called when an object is instantiated. '__' defines a magic method and was chosen back in the day because PHP didn't have protected/private members and so the common practice was to prefix private/protected members with one underscore.
PHP was a solution to Perl, so -> is what Perl uses so that's what PHP uses.
The function naming is not so much an issue either. But what is frustrating is argument order. That's something that really needs to be revamped, backwards compatibility be damned.
Parent
Re: (Score:3, Insightful)
In seriousness, I'm with the OP. I wish the ridiculous language evangelism would stop. In the end, people are just being short si
Re: (Score:3, Interesting)
Re: (Score:3, Interesting)
Thank you, you got the gist of my post.
Every language has its strengths, weaknesses, glaringly awful bits, shiningly wonderful bits, and all of the subculture that go with those things. No language is perfect or even acceptable for every job.
PHP is an extremely organic language. It is the result of hundreds of developers' efforts and the inclusion of many modules that were once addons.
I've been using it since very early version 3.0, so I know why things are named the way they are. That doesn't make them
Re: (Score:3, Funny)
slash-achievements!
Achievement unlocked: [ Post 5 consecutive posts using the Preview button first ]
Re: (Score:2, Offtopic)
PHP as I told a manager is useful because it is ubiquitous, not because it is perfect or even particularly good. At the time I worked on a derivative of GForge, which is a definite example of the horrors that can come from PHP projects.
This is also an original quote by me: "The beauty of PHP is that it is so simple even an idiot can program with it. The problem with PHP is that so many idiots do choose to program in it."
In my own hosting, I have the choice of using RoR, but the app must be manually redeploy
Re: (Score:2)
5.3 should be cool, now I just need to start pestering my hosting providers about upgrading.
Dude, dedicated server!
I also always pick PHP because its so nice to code with it and because of the box it provides so many different functions from many areas. It saves you lots of time and work if you dont need to always write your own functions for everything or google for a library. This is also why I prefer Delphi over C++.
Re: (Score:2)
Pfffft!
Everything changed with the release of Drupal (written in PHP).
We are creating several large projects each year based on Drupal/PHP and our solutions easily bests any proprietary solutions I've encountered so far.
Re: (Score:2)
You didn't get a "function already exists" type of error when it was redeclared? Strange.
Re: (Score:2)
the testing server likely had error_reporting set to 0
Re: (Score:2)
Re: (Score:2)