13
Banele
5y

I honestly do not understand why people speak so badly about PHP(that's the general vibe I am getting from all these different platforms) or maybe it's because I am still new at it I am yet to find out the reason.

Comments
  • 5
    Haters gonna hate.

    As JS, it easy (every can code). So a lot of code rapist commit "programming".

    It also carries a vibe of " not professional dev".
  • 4
    Not a PHP dev, but I hear recent versions of PHP have improved a lot, yet most devs are stuck with older ones
  • 13
    PHP dev here.
    I've seen all kinds off hell from PHP3/4 days through to 5.6 and 7+

    It's an easy language to work with, and easy language to make a gigantic mess of things and a hard language to master and keep clean.

    Performance and features have grown so far that it's not even funny, it's a heavily developed language, well since 7 anyway

    It's backwards compatible with most things, so you can usually drop your older code base into a newer version, and most things will work on day 1 then you just need to refactor what doesn't work, or make use of the newer features.

    The hate and culture of it being a shitty language comes from mostly the strict type language coders who wouldn't know how to handle a language that will accept a Boolean for 1 variable then moments later that damn thing turns into a string, a array/map/list or even a float or object. - ps: I also do java and still use php as my goto.

    Mind you I hate when devs do this too, but In saying that, the language was meant to be flexible and cater for a whole lot of shit ideas for better adoption from other languages,.

    Almost all "bloggers" who write tutorials should be avoided as they almost always show Extremely poor implementations and vulnerable code.

    But despite all its problems, despite all its hassles, there is literally nothing you can't build in PHP, it's a web language but it also works on the cli, so with that in mind, you can code virtually anything up and have it running in a server or serverless (the real serverless) environment without much hassle.
  • 2
    @C0D4 Thank you!
  • 1
    This was posted here recently
    https://eev.ee/blog/2012/...
  • 2
    @C0D4 I have two or three scripts running on my server that I wrote on PHP.

    A simple hashbang and done.
  • 2
    Because this happens
    *Not my code, it's from the guy before me as explained here https://devrant.com/rants/2155437/...*
  • 2
    I'd also have to agree with @C0D4 but I just feel that unlike Javascript which can be or not strong typed (typescript), it is much harder to use community modules and something called a linter which I haven't be able (mostly because of time constraint tho) to add to the project I'm working on in PHP. Two things that can be easily done in javascript.
  • 2
    @possum for?

    @Willbill360 sadly php allows for this, although you can make a similar mess in other languages if the dev wanted too.
  • 1
    Which php version was your first?
  • 3
    @Willbill360 ....how I laughed when I saw this code. It looks so similar to mine. I think this is going to be one of those codes when I look back I'll be like 'Who the f**k created this abomination'. Anyway, it works and I'm still learning( just to console myself 😏)
  • 3
    @Banele md5 on a password?
    Dude password_hash() 😉
  • 2
    IMO the problem it's not the language, but it's implementation. You will find lots ugly edge cases in the standard library, like comparisons that don't work as expected, ecc.

    Moreover, being one of the most common languages to start with web development you will find a number of bad examples online that are copy pasted without thinking and that lead to issues down the line.
  • 3
    @mundo03 literally just started using PHP 3 weeks ago. I'm using version 7.1.30
  • 2
    @C0D4 hahhahaha....I know...I know...
  • 1
    @Banele I won't even get started on the unsanitary data being added to your db query, although browny points for using mysqli_ so that's something, not PDO but meh, it'll do.
  • 1
    @Banele that is why.
    PHP 7 is way better than previos Versions.

    You ha e to think that all hate to PHP is either a thrend or old devs with many reasons to hate old versions.
  • 2
    As much as the people that use strongly typed languages rage at PHP, writing something in PHP takes a lot less time. If you want to make something quickly, it's good.

    Another good thing with PHP is that it has in-built functions for *everything*.

    The PHP docs are also really good.
  • 3
    @Willbill360 okay, what the fuck is that?

    My inernal PSR-ignorant is hurt...

    Ye...

    And also, to op, Ive anwsered your question many times in comments. People remember php4. People bitch about php4 not realizing its been good few years ago.

    Also people fail to understand that PHP4 code that runs on php 5.6 is STILL PHP4 CODE..

    Actually, they don't fail to understand it. They dont even try. I respect you, becouse you wanted to undestand what the hell is going on.

    People are lazy to figure out what they hate. They hate becouse humans are made that way that its good feeling to have something to hate.

    Peace
  • 2
    @C0D4

    Don't tell people who are learning mysqli_ "will do"

    of course it will work. but...

    Guys, it's PDO time, dont get used to mysqli_... PDO is universally better.

    Just do freaking prepares and youre fine.

    also, protip I figured newcomers can struggle: as funny as it sounds, escape for mysql wildcards, PDO does not do that for ya ;)
  • 0
    @DubbaThony given what he has written in that screenshot, mysqli is the least of his problems 😂

    So yea, it'll do before I start pointing out everything that is actually wrong.
  • 2
    @C0D4 yes, I know, but you know, he tries to learn basics, maybe he tries to learn standard functions etc and polish rest when he actually knows how to write a thing. But its like if he learned wrong std functions ;-;

    And you explicitly mentioned mysqli_ so I just had to react.

    Edit: I dont mention password_hash and password_verify bc someone already corrected him before so thats unneded dupe
  • 2
    Hey, just a though, might be wrong so please correct me if I am.

    Since you're learning (and I supose it's your first language), I think you're on the right path. Yes there are a things or two that can be better, but considering that, when you'll feel confortable enough with PHP, I'd suggest you take a deep look into the API/Client architecture (not sure if this is the proper name).

    I usually hate PHP because most of the PHP I've seen was with this messy syntax, so when I came across Node, I found myself obligated to separate the logic from the actual front-end, not having this restriction made me hate PHP and love Node, so I beleive that further in your learning curve, you should think about this. I suggest you take a look at Laravel for this. I'm not a very exprienced dev in a professional manner but I've been programmimg for almost 8 years, from which 3 were in PHP. I hope my input helps you a bit.
  • 2
    @Willbill360

    Just saying, if you have JS person or JS skills to write client side, that's like.. Suddenly it becomes much easier to code this way. And that's good. Dont make your life harder :)

    This is valid approach and you have my honest ++ for this post.
  • 1
    @Willbill360 Shot for the pointers man. One thing I don't like is that everything is all mixed up into this single page.
  • 1
    @Banele

    I honestly dont know how to explain it... It's just magically much much easier when you get hang of it.

    if you are gamer, it has a lil bit higher skill floor, but a lot higher skill ceil, where your approach has very low skill floor, and medium skill ceil.
  • 3
    The language is fine.

    The problem are idiots who tried PHP3/4 once and are still convinced that it is bad.

    Even worse are the folks who have not even opened a PHP file in their life but have internalized the attitude of PHP hating from other idiots who have not touched PHP in years if at all.

    PHP as a language is powerful and the ecosystem and conventions are super healthy these days.
Add Comment