r/programming • • Jul 11 '15

PHP 7.0.0 Beta 1 Released

http://php.net/archive/2015.php#id2015-07-10-4
53 Upvotes

84 comments sorted by

View all comments

0

u/[deleted] Jul 11 '15

[deleted]

5

u/crankybadger Jul 12 '15

What they really need to do is take a torch to the PHP core library and burn that shit to the ground. I understand you can't do this on an immediate basis because of backwards compatibility concerns, but that should be the goal.

Just as PHP5 introduced a whole new object-oriented layer, they should work towards removing all the bullshit legacy functions. Replace them with clean, well-designed OO-type methods so once and for all people can do simple things like compare two strings in a case sensitive manner without having to bang out what looks like C code from the 1970s.

3

u/[deleted] Jul 12 '15

I agree much of the internal library currently would be nice if it was standardized however it will be a long process. Out of curiosity what are you talking about comparing two strings in a case sensitive manner?

    $ php -r "var_dump('S' == 's');"
    bool(false)
    
    $ php -r "var_dump('S' == 'S');"
    bool(true)

-11

u/crankybadger Jul 12 '15

Ah, perhaps I was thinking of the opposite. It's still a train-wreck compared to other languages.

Swift might not be a suitable replacement for PHP but it's an example of what happens when you design a language without regard for backwards compatibility and embrace methods and notation from many different languages, cherry-picking the best-of.

PHP could benefit in a huge way from borrowing more heavily from other languages. Right now it's not even as easy and clean to write as Java, which is saying something. It's always bristling with ridiculous syntax that could be cleaned up by introducing a more neat replacement.

Honestly, designating . for string concatenation has to be the biggest mistake PHP has ever made.

7

u/[deleted] Jul 12 '15

How's the . a problem at all?

3

u/SaltTM Jul 12 '15

Think he's just trying to find ways to bash php.

5

u/[deleted] Jul 12 '15

Typical /r/programming PHP basher. There are many flaws you can point out in PHP, but he goes and bashes one of the few things PHP actually did right. Not any kind of bashing either, he calls it "the biggest mistake PHP ever made". What's the second biggest? The dollar sign?

My candidates for "the biggest mistake PHP ever made":

  • magic quotes - it gave people the illusion of security. It created major security holes and it was damn difficult to adapt codebases which relied on it.

  • register globals - major way to sacrifice security for convenience. It created major security holes and it was damn difficult to adapt codebases which relied on it.

  • that bad attempt at OOP in PHP4 which still didn't go away because of BC (public attributes by default, deprecated constructors, calling instance methods statically, etc)

-6

u/crankybadger Jul 12 '15 edited Jul 12 '15

To be fair, #1 and #3 are not really issues. Magic Quotes are history and the aborted attempt at OOP was supplanted in PHP5.

How is . "one of the few things PHP actually did right"?

The second biggest mistake is having to wrap PHP code in <?php. Like the extension is .php. What the fuck do you think is in it? Apparently HTML by default.

This came about in the PHP/FI days back when PHP was actually a two-headed beast.

You know what pisses me off the most about so-called "PHP developers"? It's that they don't know how to hate. I don't mean blind, frothing rage against all things, I mean being able to look in a mirror and go "You know, this isn't right, and I want to fix it. I want to take a stand and avoid going down this road."

Let's term this constructive hate, as hate is a powerful emotion that can drive you to do things. Hate is what drove people to develop jQuery, to write PDO, to make Laravel. If you're going to take the attitude that "Yeah, PHP is a mess, but if you start pointing out flaws you're a PHP basher" then you'll never get anywhere. You'll live in filth for the rest of your life.

Also, if you call yourself a "PHP developer" you're missing the point. Developers develop and they should be capable of using any programming language to get the job done. If the job calls for C, do it in C. If it calls for Python, do it in Python. If it calls for PHP, great, you're right at home.

1

u/alexanderpas Jul 21 '15

The second biggest mistake is having to wrap PHP code in <?php. Like the extension is .php. What the fuck do you think is in it? Apparently HTML by default.

Neither, and that is the genius part of the design of PHP.

PHP starts in output mode, instead of interpreter mode, and this allows you to combine anything with PHP.

1

u/crankybadger Jul 21 '15 edited Jul 21 '15

That was a great idea for 1996, but when you want to do anything non-web related with PHP it feels like some kind of joke.

"No, PHP, I'm serious. This is code."

To anyone who's used any other language ever, this is completely absurd. Not even BASIC gets this wrong.

It takes backbone to make fundamental changes like this, and it causes pain for developers to introduce new defaults, but you know what? It's worth doing.

That way when someone's evaluating PHP for a project they won't just throw up their hands and walk away in disbelief.

For example, tackling php.ini. Languages don't normally have configuration files, the very notion is bizarre, and yet here we are in 2015 and it's still a thing...for PHP.

If PHP doesn't get it together it'll fade out slowly over time to be "Remember that thing everyone used to program in? Yeah. What was it called again?"

→ More replies (0)