People base their opinions on PHP off a decade old article comparing it to a double sided hammer of some sort.
All of that is unjust, as currently PHP is a perfectly sane language and it's OOP-approach is miles ahead of that of Ruby or even Go. Besides, it doesn't use whitespace as syntax so that makes it automatically a magnitude better than - included but not limited to - Python.
>OOP-approach is miles ahead of that of Ruby or even Go
you can't be serious. you must either be a java-fanatic or simply an idiot who doesn't comprehend what good OOP is.
>doesn't use whitespace as syntax so that makes it [...] better than [...] python
other languages may suck at this, but the way python handles is isn't so bad. i wouldn't mind python having an 'end' statement like ruby instead of whitespace based code evaluation, but at least it forces idiots to indent their fucking code right. more to the point, this doesn't make php a better language than python _at all_ - perl doesn't use whitespace either and just look at it.dear god.
its funny because i would say the direct opposite
professional PHP dev for the last 5 years.
it just werks
i've built everything from console applications communication over sockets to scammy survey websites with 1 million users a month.
It lets you just get work done and get paid.
1) In PHP it is easier to write bad code than in most other languages. But there is nothing inherent in the language preventing you from writing good code.
2) It is weakly typed, this can lead to hard to track down bugs and is a valid complaint.
3) They are mad that someone learns PHP and gets a 100k/yr job and they know some meme language like rust or go and no they are unemployed.
Laravel is garbage, it's an abstraction layer on top of symfony and doctrine to make its syntax like ASP.NET MVC. The best framework I've run across in PHP is called Phalcon. It's compiled into the core of php, which can be a right pain in the dick if you're on shared hosting, and it's syntax isn't as pretty as Laravel, but it's the fastest by a country mile. And before some autistic asshole comes in and starts yelling about how I can increase my RPS by adding more servers, the most important metric from an end user perspective is TTFB, and in that regard, I've written applications in Yii, CodeIgniter, Zend, Laravel and Symfony, and Phalcon gets bits on the wire ten times faster which is a better end user experience.
We had a developer working under me who didn't like Phalcon because he was hopelessly enamored with Laravel. So we both built a simple REST API that made a database call and returned it to the client. We deployed this to our data center, and ran them side by side. Not only could Phalcon handle 4x the requests per second, but Phalcon returned the data in about 12ms, with a 5ms ping to the server, and Laravel took over 200ms.
He didn't write it over, he showed you the execution of the function. It's a nested ternary which is possible in any language and is always a terrible idea as it's impossible to read.
Actually it's insanely easy, you just need to be able to install extensions on the server. CPanel I think even lets you install phalcon now. The best thing about phalcon is that once the extension is installed, you have access to all the classes in phalcon without any classloading whatsoever because at that point they essentially exist in PHP.
I mean, if your goal is to get a working webapp in the shortest amount of time possible, then sure, php will get you there. It might end up being un unmaintainable mess for everyone else who ever has to touch it again. If you actually care about more than just getting your check, you're not going to use php for anything major.
I'll admit that I'm perpetually mad about this because the poor decisions of some of my predecessors have left me partially responsible responsible for keeping huge, ugly messes of php running and I hate every second I have to spend touching it.
php only just werks because of its prevalence over the last decade means shit like apache's mod_php is enabled by default all over the place, which is a fucking awful approach to running dynamic web backend code. php is only write-'n-upload if you're deploying it in a retarded way that crumbles at any sort of scale. The initial investment in setting up a stack like nginx+uwsgi+whatever framework you want is admittedly a bit more work, but leaves you with a much saner, more versatile environment.
Backends don't matter anymore with the emergence of backend as a service platforms(PubNub,Parse,Firebase,backand.com) wherein the front end/mobile devs also build the stuff needed for their APIs
Zephir is the fucking shit. It's young, but if it gets any serious backing and gets some years under its belt, it is going to fucking rock. Last benchmark I saw it was about 3 times as fast as HHVM and PHP7.
i'm sorry but that can happen to virtually any code base, its not PHPs fault someone wrote ugly code.
If you can't figure out what's calling that function, then you have shit problem solving skills and need to pick a new profession.
i'll have to look into that, sounds pretty neat, when you said compiled into PHP i thought you meant like a recompile. That sounds insanely nice.
Stuck with laravel atm
its kinda nice once you get used to it, but feels seriously bloated at times.
ANYTHING is better than zend.
>i'm sorry but that can happen to virtually any code base, its not PHPs fault someone wrote ugly code.
It totally is though. The documentation and the language tutorials all over the web actively encourage people writing unmaintainable spaghetti code. Even Perl 5 has owned up to its reputation of write-only code and the recent documentation really encourages you to write cleanly and well.
>The fact that someone chooses to write code in a ten year old style rather than in a modern OO style is somehow the language's fault.
Laravel is pretty much Babby's first framework. It has really nice, easy to understand syntax for a newbie, but it's just bloated as shit.
Because it's the way he wrote it to work..
That's the language doing it right... If you put that in another language and got "a", it would not be checking all of the parameters of the call.... B was declared after A so it is the one that is correct.
At this point, the best language for webapps is visual basic with a c++ wrapper for rendering. Anything else is absolute trash tier.
>>The fact that someone chooses to write code in a ten year old style rather than in a modern OO style is somehow the language's fault.
Yes it is, because the language encourages it. Properly designed languages discourage deprecated features and bad code by spewing warnings all over the place, only PHP doesn't do that because if a warning gets written to stdout it breaks bad old web pages that use the bad old style.
>PHP doesn't do that
It kind of does unless you turn off errors.
The interpreter basically turns that unintelligible garbage into ((true) ? "a" : true) ? "b" : "c".
Compilers have to do something with it. They have to give some order of operations. It isn't right or wrong, it's just how the compiler handles that vague code.
Whatever you say, professor.
There two ways to interprettrue ? "a" : "b" ? "c".((true) ? "a" : true) ? "b" : "c"
ortrue ? "a" : (true ? "b" : "c")
Just because a language uses one approach versus the other does not make either language wrong. It means that you're a shit programmer if you write code that can't be read.
>Just because a language uses one approach versus the other does not make either language wrong. It means that you're a shit programmer if you write code that can't be read.
Fucking this, (almost) every "PHP is bad" example is some ambiguous travesty of logical notation that should have never been written to begin with.
If your goal is to write unreadable code that means nothing clear but gets interpreted the same way the other programming language you threw your shitty code into, PHP isn't the language for you.
You fuckers can't be this stupid. It's compiled at run time you dumb fucks. PHP scripts end up as binary which gets executed, those binaries can be cached in an opcache and executed without any re-interpretation. They are compiled.
Actually it's perfectly fine to do it, because every other programming language that isn't PHP and has a ternary operator correctly makes it right-associative:
TRUE ? "a" : (TRUE ? "b" : "c")