What to do before learning PHP?

Discussion in 'Programming' started by Dewlance, May 19, 2019.

Tags:
  1. Dewlance

    Dewlance Aspirant

    17
    6
    +0
    Hi,

    I am not sure but I think If you want to become a PHP programmer than first you will be need to some other programming?

    Which one?

    Someone said that first learn that language(Maybe C or C++) so it will be easy for you to learn PHP. Is this true?


    Thanks.
     
  2. overcast

    overcast Enthusiast

    124
    23
    +22
    To be honest you don't need to learn any other language before PHP. Just directly getting into learning would be a good start.

    All you need is say XAMPP or Bitnami WAMP/MAMP or LAMP stack or say PHP server to download. And then just code editor and you are set.

    If you are learning this specifically for the forums and blogs, then learning PHP directly is a good start.
     
  3. LeadCrow

    LeadCrow Apocalypse Admin

    6,352
    1,232
    +2,129
    Evaluate first wether you really need more than nominal php proficiency. If your app, addin or web service works with external data sources, you light find other languages scale better, easier to learn and in higher demand nowadays.
     
  4. MagicalAzareal

    MagicalAzareal Magical Developer

    195
    48
    +73
    PHP is a beginner language. You do not need to know another language to learn it.

    I would usually recommend something like Python, however as it helps building a stronger foundation and you can use it for far more things than simply just web development. E.g. AI, games, scripts, etc.

    It can also completely destroy PHP in performance and you're less likely to run into a number of gotchas.

    I personally learned C++ as my first language, when I was 11 if I recall (stack vs heap and the imprecise definitions of types which varied between compilers melted my brain then ;_; ). The knowledge is certainly helpful elsewhere, but not really necessary.
     
  5. mysiteguy

    mysiteguy Devotee

    2,851
    887
    +2,184
    The opposite is the truth. Python, since version 7.x of PHP, does worse in every standard benchmark.

    regex-redux
    source
    secs mem gz busy cpu load
    PHP 2.80 158,000 816 5.48 23% 37% 43% 93%
    Python 3 17.77 446,136 512 33.55 30% 77% 30% 51%

    spectral-norm
    source
    secs mem gz busy cpu load
    PHP 33.12 24,140 1152 131.98 100% 100% 100% 100%
    Python 3 169.41 52,492 443 673.42 99% 99% 99% 99%

    n-body
    source
    secs mem gz busy cpu load
    PHP 312.82 8,032 1082 316.25 57% 0% 0% 43%
    Python 3 797.11 8,036 1196 808.64 0% 100% 0% 1%

    mandelbrot
    source
    secs mem gz busy cpu load
    PHP 117.20 127,020 875 468.20 100% 100% 100% 100%
    Python 3 259.96 52,164 688 1,039.13 100% 100% 100% 100%

    fannkuch-redux
    source
    secs mem gz busy cpu load
    PHP 226.26 21,980 1160 901.84 100% 99% 100% 100%
    Python 3 472.21 49,992 950 1,867.32 100% 100% 96% 99%

    k-nucleotide
    source
    secs mem gz busy cpu load
    PHP 41.23 176,076 1079 134.55 90% 72% 71% 94%
    Python 3 73.42 188,504 1967 279.54 94% 95% 95% 97%

    binary-trees
    source
    secs mem gz busy cpu load
    PHP 50.51 1,584,428 751 182.85 96% 91% 91% 85%
    Python 3 79.88 450,792 589 283.61 91% 85% 86% 94%

    pidigits
    source
    secs mem gz busy cpu load
    PHP 2.16 9,112 399 2.25 100% 2% 2% 0%
    Python 3 3.34 10,124 386 3.41 100% 1% 1% 0%

    reverse-complement
    source
    secs mem gz busy cpu load
    PHP 13.60 528,064 438 20.95 33% 33% 26% 62%
    Python 3 17.70 1,007,220 814 22.18 23% 38% 17% 47%

    fasta
    source
    secs mem gz busy cpu load
    PHP 56.53 8,072 1062 57.08 0% 0% 1% 100%
    Python 3 62.88 683,204 1947 139.86 47% 59% 56% 61%

    PHP 7.3.5 (cli) (built: May 8 2019 14:40:28) ( NTS )
    Python 3.7.3
     
    • Informative! Informative! x 2
    • List
  6. MagicalAzareal

    MagicalAzareal Magical Developer

    195
    48
    +73
    PHP is probably calling into C to do all the work for it there.
    This is a little something we call... Cheating.

    You can call into C from Python too.
    Also, which brand of Python is it? CPython? Pypy? How many threads / processes?

    Pypy is usually best for pure number crunching like that, I believe.
    Where PHP tends to fall apart peformance-wise is when you have something more complex than the thinnest wrapper around C and have to do real logic.

    Also, PHP doesn't support Unicode natively. Python does.

    upload_2019-5-21_15-24-5.png

    upload_2019-5-21_15-24-59.png

    upload_2019-5-21_15-25-42.png

    upload_2019-5-21_15-39-53.png

    I could throw out more numbers, but there is little point in even trying to debate it.
    This is just a tip of the iceberg anyway, a program which literally does nothing but a bit of a templating and pushes out a response isn't the best test of performance.

    Not that I like Techempower's benchmarks, they're suspect like most benchmarks, but this clearly depicts the tiers of performance of the stacks to some extent.
    Do note though that JavaScript uses a JIT compiler, so this isn't exactly representative of it's performance in contrast to PHP, it underplays it.

    PHP had a JIT compiler by the name of HHVM, but Facebook seems to be dropping support for PHP in favour of their homegrown language, Hack. I don't think it ever got that much adoption anyway, as it wasn't able to optimise the complex source-code of Wordpress as-well as it did for things written in a more modern style.
     
    Last edited: May 21, 2019
  7. mysiteguy

    mysiteguy Devotee

    2,851
    887
    +2,184
    Use of HHVM dropped quite a bit after PHP 7.x, because it was generally yielding performance as fast or faster than HHVM.

    We can get into a debate about what is the best language, but that's not why I commented. I've seen "best language" debates going back as far as I've been coding (late 70s) and no doubt it started the first time a non-assembly language was made. In the 1980s, on PC's it was all about C versus Pascal (Turbo Pascal was considered a game changer by many though I never cared for the language).

    The point is Python isn't better, PHP isn't better, and one isn't necessarily faster. One can throw out pros/cons "proving" one thing or another, but they really don't prove anything.

    They are suited for different things and the "best" language is whatever language allows you to get the job done most efficiently, and maintain it efficiently.

    While PHP still allows sloppy code, and is easy for a beginner to pick up, I wouldn't necessarily call it a beginner's language, at least not these days. Heck, even BASIC in some implementations is far more than a beginner's language.
     
  8. MagicalAzareal

    MagicalAzareal Magical Developer

    195
    48
    +73
    Use of HHVM dropped because it didn't make Wordpress and MediaWiki faster.
    HHVM made Facebook's code over forty times faster over Zend's PHP as their code-base is specifically optimised for it.

    Facebook didn't waste countless man-hours just for something that can be achieved by optimising a hashtable algorithm and reducing the number of memory copies. The other big thing was that Zend moved opcache into the core, but I think any serious site would have been using some sort of accelerator anyway.
    This isn't really the place for a debate. I simply stated things in as brief a fashion as possible, so we can agree on not getting into one.
    There is empirical evidence that one is in-fact faster than the other, which is what you responded to in my original post. Also, keep in mind that I left out frameworks like Laravel and just focused on raw PHP7 performance, just to be nice ;)
    I can agree with this logic in principle, although I'm not convinced that it is in-fact the best tool for the job, however this really depends on the specific circumstances.
    Python could also be considered a beginner's language, as it's an introductory language used in many schools and colleges for people to come to grips with programming.
    It is also in use by countless scientists throughout the world for very serious work and at giants like Google.
     
  9. Erin Nicole

    Erin Nicole Habitué

    1,053
    232
    +273
    I wouldn’t say you would need to learn anything else before PHP. PHP is pretty easy to learn. I’d recommend HTML/CSS though you can learn PHP on its own without any other language. I would just start learning PHP and if you feel you need HTML/CSS or any other language to learn to fully learn PHP then you can do that but, personally, I think that everything is built off of HTML/CSS. I doubt that is the case but HTML/CSS is the most basic coding you can learn so I always recommend people start there and work their way up. That’s what I did. 99% self taught as well.
     
  10. Karll

    Karll Adherent

    339
    117
    +143
    PHP is probably fine, though you often need to learn other skills as well in order to develop the kind of software where you typically use PHP: JavaScript, HTML, CSS and last but not least SQL and database schema design.
     
Verification:
Draft saved Draft deleted
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.