What to do before learning PHP?

Dewlance

Aspirant
Joined
Jul 28, 2015
Messages
17
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.
 

overcast

Adherent
Joined
Mar 17, 2019
Messages
474
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.
 

LeadCrow

Apocalypse Admin
Joined
Jun 29, 2008
Messages
6,562
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.
 

MagicalAzareal

Magical Developer
Joined
Apr 25, 2019
Messages
711
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.
 

mysiteguy

Migration Expert
Joined
Feb 20, 2007
Messages
3,079
It can also completely destroy PHP in performance and you're less likely to run into a number of gotchas.
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
 

MagicalAzareal

Magical Developer
Joined
Apr 25, 2019
Messages
711
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:

mysiteguy

Migration Expert
Joined
Feb 20, 2007
Messages
3,079
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.
 

MagicalAzareal

Magical Developer
Joined
Apr 25, 2019
Messages
711
Use of HHVM dropped quite a bit after PHP 7.x, because it was generally yielding performance as fast or faster than HHVM.
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.
We can get into a debate about what is the best language
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.
One can throw out pros/cons "proving" one thing or another, but they really don't prove anything.
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 ;)
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.
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.
I wouldn't necessarily call it a beginner's language
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.
 

Erin Nicole

Habitué
Joined
Jul 13, 2014
Messages
1,053
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.
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.
 

Karll

Adherent
Joined
Dec 9, 2011
Messages
428
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.
 

martin smith

Participant
Joined
Jan 22, 2018
Messages
86
Before you start learning PHP you need a basic understanding of HTML If you already have it, great. If not there are plenty of HTML articles and tutorials to help you When you know both languages, you can switch between PHP and HTML right in the same document.
 

Panupat

Habitué
Joined
Feb 12, 2010
Messages
1,623
You can jump right in. PHP can be your first language. Assuming you already know some basic HTML that is.
 

overcast

Adherent
Joined
Mar 17, 2019
Messages
474
For some reason I started to like python and golang. Though framework wise PHP is father to these two with market dominance too. I think if you still learn python and golang you'd find youself in better position in near future.
 

gConverter

Participant
Joined
May 7, 2016
Messages
76
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?
After the PHP you should make sure you know JavaScript very well, learn (NodeJS, AngularJS, ReactJS, Vue.js). That's the best way to become Full-Stack Developer.
 

forumowner

Aspirant
Joined
Apr 6, 2020
Messages
23
PHP Is extremely easy

you can just jump right in
learning a more complicated language beforehand would be pointless
 

overcast

Adherent
Joined
Mar 17, 2019
Messages
474
PHP is easy but i think long term learning python as first language is more beneficial.
 

kik0lasi

Aspirant
Joined
Mar 17, 2020
Messages
16
I learned it while developing a phpbb forum, it's easy, I knew java before but dont think it will be needed for learning php
 

ips_doug

Enthusiast
Joined
Feb 28, 2018
Messages
130
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.
This.
 
Top