Live data from Hacker News

PHP 7 Released

github.com

231–240 of 317 posts

Re: PHP 7 Released

#231

Why do they keep adding global functions like "intdiv"? For example in JS, it being another language with a similar compatibility burden, they are moving most of the global functions (like parseInt) to "namespaces" (like Number.parseInt) while keeping global references there. When I open the docs (for example, the array functions page[1]), I get frightened by the global functions which do not seem to share a naming c…

When you put stuff in namespaces you need to remember in which namespace it is (and which library to refrence). Number.parseInt is not that bad but I'll take to_json() global function instead of (new System.Web.Script.Serialization.JavaScriptSerializer()).Serialize() (or was it Newtonsoft.Json.JsonConvert.SerializeObject()?) any day. Sure, names of PHP functions look arbitrary and inconsistent but when you know the n…

> When you put stuff in namespaces you need to remember in which namespace it is (and which library to refrence).

This is comedy gold! I almost didn't spot the sarcasm :-D

Re: PHP 7 Released

#232
post #101

Earlier quoted context omitted.

I could've done that but that wouldn't have taught the same things. PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co. It's easier point to framework that's already using PDO and and making sane defaults and solving bootstrapping problems. Once you've learned bunch of new concepts like ORM in one frame…

Agree, then again there are different types of people. Some wants to learn from bottom up(analytic approach), others want to see cool stuff then tweak, modify, replace to find the limits (holistic approach). IIRC there is a tendency that young people prefer the holistic approach while teachers either are selected for or grow into preferring the analytical approach.

Doesn't holistic approach just make sense?

It's not like you learned to speak with your parents reading you the dictionary beginning with the letter A.

Re: PHP 7 Released

#234
post #233

Why, ohh why, won't this freak of nature (language) just die :-(

I've recently found this gem: http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

I haven't laughed this much in a long while. PHP was my first language and indeed I got far away as soon as I knew any better.

Re: PHP 7 Released

#235
Great release! I think the BC breaks are all justified :)

And all the shared hosts around still stuck at 5.3 or so, this is your time to move forward. At least start offering a PHP7 version, if not a straightway upgrade.

Huge thanks to the internals for their hard work.

Re: PHP 7 Released

#236

Earlier quoted context omitted.

Yep. PDO still leaves room for string concatenation issues. Unfortunately, so does Doctrine.

People who want to do string concatenation will continue to do so no matter what we tell them. At some point, we have to educate users. Giving them an easy-to-use alternative is a step in the right direction.

Why not have the obvious API call for making a query only accept constant strings? You can still have an escape hatch for the rare cases where an expert needs to do something fancy, but hide it well and make it scary and you shouldn't have many problems.

Re: PHP 7 Released

#237
post #101
post #63

Earlier quoted context omitted.

> I urged him to switch to a sane framework like Laravel ...why didn't you taught him about PDO, so he can start with something more universal, not tied to one particular framework that happens to be popular nowadays?! Then he can learn whichever OR/DM or DAL he might like need (Eloquent, Doctrine, Redbean, IdiORM/Paris etc.), and also be able to pop the hood and debug it when needed. I never get it why so many other…

I could've done that but that wouldn't have taught the same things. PDO is awesome but requires deeper level of understanding (for a beginner), which may increase the frustration and may end up returning back to the mysql_query and co. It's easier point to framework that's already using PDO and and making sane defaults and solving bootstrapping problems. Once you've learned bunch of new concepts like ORM in one frame…

> Laravel ... solved lots of existing annoyances regarding PHP coding for me.

Can you name a few such annoyances and how Laravel addressed them?

And do you mean to say that Laravel addresses them, while other frameworks don't?

Re: PHP 7 Released

#238

Earlier quoted context omitted.

I do to, except with heavy frameworks.

Yep you're right, its the framework bootstrapping that's the killer, especially when those frameworks are expensively parsing config files each time (Yaml, XML...).

Which modern frameworks never do. The parsed data is usually cached in a php file. Then the (compiled to bytecode) files are cached in opcache. The interpreter doesn't even hit the filesystem on every request.

Re: PHP 7 Released

#239

Earlier quoted context omitted.

People who want to do string concatenation will continue to do so no matter what we tell them. At some point, we have to educate users. Giving them an easy-to-use alternative is a step in the right direction.

Why not have the obvious API call for making a query only accept constant strings? You can still have an escape hatch for the rare cases where an expert needs to do something fancy, but hide it well and make it scary and you shouldn't have many problems.

Right, well, "constant strings" don't really exist in scripting languages, and before you mention objects that encapsulate them, what's to stop developers from building them elsewhere before passing the string to an object that encapsulates them?

Chicken and egg.

Education is the security strategy that pays forward the most.

Re: PHP 7 Released

#240
post #233

Why, ohh why, won't this freak of nature (language) just die :-(

I don't use PHP anymore. However, if you want to web program it really is the easiest to get started. So many of my friends who have no interested in programming but want to do simple web stuff learn how to setup apache with PHP and copy paste what they need.
Post reply on HN