6 ms·
One of the biggest complaints I've read about PHP is that many things are not consistently named (having never used PHP, I might be wrong). If this is true, are
by irrational 7y ago
One of the biggest complaints I've read about PHP is that many things are not consistently named (having never used PHP, I might be wrong). If this is true, are there any plans to fix this?
- duncan-donuts 7y agoIt is true and no I don’t think there’s much talk of changing it. There’s also a problem with inconsistent method arguments. Just look at array_map[1] and array_reduce[2]. This is just the one example that bit me the most, but there are other inconsistencies like this all over the language that require you to constantly look things up. [1] https://www.php.net/manual/en/function.array-map https://www.php.net/manual/en/function.array-map [2] https://www.php.net/manual/en/function.array-reduce https://www.php.net/manual/en/function.array-reduce
- nkozyra 7y agoI remember reading a cogent explanation for this inconsistency but can't seem to locate it. JavaScript suffers from inconsistent mutation/return of array values in array functions, too. PHPs design problems are mostly being swept away; it's the legacy that keeps its reputation down.
- aspratley 7y agoRasmus Lerdorf has talked about it in other videos but this is one https://youtu.be/iGOAQli7tGc?t=1485 https://youtu.be/iGOAQli7tGc?t=1485 Basically, groups of functions are consistent: string,array etc. Their parameter order was usually based on whatever the underlying C API was.
- cdirkx 7y agoI just encountered this last week. I had to explain to my fellow non-IT students why I was making loud gasps of confusion.
- Moru 7y agoI use an editor that has the php help built in to not get confusing errors. You type the beginning of the command and it directly tells you what part is the needle and what is the haystack.
- dana321 7y agoArray map takes one or more arrays with a callback, so the arrays have to be on the end. Array reduce has one array as a parameter, as does most of the other functions and they all have the array as the first parameter. Its only one function, and its an inconsistency for a reason. Lets not blow it all out of proportion.
- conradfr 7y agoIn practice it hasn't been a problem for me in a long time (I've been doing PHP since PHP3 so I have some perspective on it). First the documentation is fine and easily accessible, second your IDE will hint you the correct order and finally in a real world web framework situation you don't even use those functions that much anyway. My biggest complaint would in fact be the concurrency situation, it's still not easy and relies on external libraries that feel half-hacks. I guess Elixir spoiled me in that regard.
- tpetry 7y agoAnd when enabling strict types you will get an error anyway if you have the wrong order because the types will not match.
- akie 7y ago"My biggest complaint about this language I've never used is something I'm not sure is true. Is it?"
- irrational 7y agoWell, I have worked as a web developer for 20+ years. I've heard that PHP is inconsistent dozens, perhaps hundreds of times. I've just never verified it myself since I've never used PHP.
- haolez 7y agoMaybe the Hack language?