Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Agreed, I actually really like PHP. And like you said it has some quirks, but I feel like everyone hating it for that has never touched javascript for example
-
sure we should use all the tools in our toolbox, rather than a hammer for a screw. But for a general purpose, web focussed language - it's pretty damn good at its job.
-
@brod I love JavaScript don't get me wrong. but.
console.log("string" instanceof String);
console.log(typeof NaN);
console.log(NaN === NaN);
still though I love JS and have been swoon by vuejs :) -
tobbeboi7048yLike someone else said, it pays the bills. Working with a nice framework like laravel makes it a lot more fun also. And the amount of examples and issues posted by other people guarantees you always find a solution. This is the biggest let down working with newer languages, you have to solve the issues yourself
-
skanna3448yIt's getting better and pays the bills, but honestly, how many of you are actually proud of saying "I'm a PHP dev" to other devs?
-
@skanna I am proud to call myself a PHP Developer and will say it if my life depends on it. language has its weaknesses as well as any other language, be it JS, Python, Java, ASP etc. I don't hate on other languages (maybe except for Java, but that's a personal preference and not just because 'Java sucks').
as said above PHP used correctly is very powerful language, thing is a lot of people consider WordPress, joomla, moodle and drupal the best examples of php and that is crap there are good developers among us...
also the language is moving more and more towards multipurpose usage, not just web. that is why most releases aim towards CPU optimisations it might even slbecome a "competitor" of python.
and let's be honest bithching about "how bad it is" does not help anyone + obligatory
https://destroyallsoftware.com/talk... -
@skanna who gives a fuck what other devs think? The ones that look down on you are obviously pompous cunts with their head up there own arse.
-
skanna3448y@helloworld @dev-nope @ctrlz I'm currently working at a shop company and, god, you have no idea of how messy the codebase it.
Php short tag everywhere opening and closing, mixed with HTML, the worse thing I've seen ever. Classes used in the wrong way, using globals inside.
We're doing a big big refactoring using Symfony, but still, inconsistencies are in the language. see one of the my previous post to see how php behave with the String "x", casting it to both true and false.
still, check the syntax of the various array functions.
still, why the usort function is "not stable"? Surprise. You will discover this only later on
Now I really get why people don't use PHP for serious stuff (like banking).
I like it, don't take me wrong, but I think that's a quite bad language. -
@helloworld you sir have a way with words ;) @dev-nope I couldn't put it better if I tried, as someone who has worked his backside off to become a developer, I'm proud to say I'm a PhP developer :)
-
@skanna Symfony is a great way to refactor a horrendous codebase, and I agree there are in consistencies - however generally these are well documented and alternatives offered (via open source contributions) as developers it's our job to spot these and act accordingly
I mean technically in python 2.7 you can overload True and False, and
x = 1
print(x is 1) # return true
y = 1000
print(y is 1000) # returns false
as long as it's documented, I don't think it makes a bad language, nor a scalable language - I think open source languages will always have the occasional quirk and once it's in there, it's a bastard to deprecate, especially when there are other potential bugs and optimisations that need to take president (when the quirk isn't technically broken)
or something. đ¤ -
jstaiyou7098y@skanna I think there's nothing to be ashamed of. If you like the language and/or it pays your debts, then why not to say it loud and clear?
If you aren't proud of what you're doing, learn other language you actually like.
I believe we all, as developers, should feel like we're doing good to society and the world as our duty is making things work in a way only we can. If you don't feel that way, develop other language or for other company, or don't be a dev. No offense, I'm just saying mental health depends on feeling good with what we do. -
dayo30458yPHP is so easy to pick up so it attracts a lot of "learners/newbies" they then produce poor, inefficient and insecure code. This is what people think of when they hear PHP. Other languages have a much steeper learning curve so scare off most "newbies".
When PHP is written well it can be a joy to maintain, but when it is written poorly sometimes you just want to hand in your notice and run. -
dayo30458y...
I personally prefer JS and Node.JS but I still use PHP on a daily basis (after re-coding the whole codebase as it was some of the worst code I've seen). -
flag020318ywhy does web languages (like php and js) and network stack for others are the quirkiest of all?
-
@skanna you should note in my comment when I am referring to the bad developers, the code base you work on or the shop maintains is a consequence of poor development, not of the language itself + short tags are removed AFAIK in PHP7, so some stuff are being worked on and fixed for good. the mixed html and php are the legacy of its 'template language' past...
although can agree on some syntax of array functions, but you just have to get used to it and is fine, as well as with the dirty quirks inside the language, but hey it is improving and the backward compatibility is huge (those array functions ware implemented quite a while back +/- 7-8 years maybe more (am lazy to check the docs)) -
fergor2328yLets be realistic. PHP is a badly designed language.
- Native function return inconsistency
strrpos can return any number and false. Then
!strrpos("hello", "hello world") //true
!strrpos("hello", "Big potatoes"); //true
(Solution: use === with false)
- Native functions names inconsistency
str_shuffle()
str_split()
str_word_count()
strcasecmp()
strchr()
strcmp()
- 0 == false == "0" == "" == array() == null (Solution: use ===)
- My favorite
$a = 0;
$b = 'x';
var_dump(false == $a); //true
var_dump($a == $b); //true
var_dump($b == true); //true
lol false equals true then??
(Solution: use === )
devs who are new or come from strict languages always fall to this pitfalls once.
But even with this issues PHP has the best fucking documentation ever. And no one can deny this.
You go to php.net and you got for each function a concise and clear explanation with one or more real examples with comments from the community. Compare that with Python documentation. -
fergor2328y@ctrlz yes, if you cast any string to a numerical value and that string does not contain any numbers it will be casted to 0.
So with the == operator, php internally will cast 'x' to integer and because it has no numbers it will be converted to 0.
Then:
0 == 0 //true -
dotomaz8858y@fergor these are the basics of dynamic typed languages. Javascript is very similar and also has the === operator. Problem is that devs come from static typed languages and don't read the documentation. Then you get the post like yours. If you know the language you know when to use == and when === ( hint: you should use === in most cases).
If you don't know how to use the language it doesn't make it a bad language. It just makes you a bad programmer. -
fergor2328y@dotomaz exactly what I said.
And I use ===, and the new php7 strict typed features.
That reduces my tests density by half.
When you see that benefits, you start to question "Why the heck PHP has not removed == operator already? So much rants are generated by this operator"
The good practices and decisions that I take doesnt remove from the map all the people that keep failing on the same pitfalls. So Im not changing my vision about this. -
xorith26768yI'm a developer. PHP is one of my tools. I don't blame a tool for failing, I blame the tools misusing it.
Related Rants
I'm sick of how much abuse PHP gets from other programming communities. PHP written well, using PHP 7 is comparatively quick. yes it has its quirks, just like JavaScript, but just because you can do stuff in multiple ways, and the language has a few inconsistencies doesn't make it a bad language. The recursive flag in bash applications changes case inconsistently (I.e. zip and cp) but that doesn't get bashed (lol) half as much....
I think I need to finish my coffee this morning
undefined
communities
programminv
inconsistent
php