Which programming language should you learn?
Pick your first language from what you want to build, not from a popularity list: PHP and JavaScript for websites and freelance work, Python for data and AI, Kotlin and Swift or Flutter for mobile. The second language comes far faster than the first, so this decision matters less than it feels.
- Lesson 3 of 14
- Beginner
- Free, no signup
One question, before any comparison
The answer to this takes half the language list off the table.
Are you building something people open, or something that eats data?
PHP and JavaScript
- Company sites, shops, blogs, a simple panel
- WordPress, which is itself written in PHP
- Anything that moves inside the browser
- The shortest road to a first freelance job
Python
- Data analysis, reports, cleaning messy files
- Working with AI services and automating chores
- A ready library for work you would write in two weeks
- But not the fastest road to a first local income
This fork does not cover every branch. Mobile and games are a third one, decided by the platform, and section four of this lesson covers them.
Last checked: Facts and tool names in this lesson are re-checked against their sources on this date.
Start by saying what you want to build
The question "which language is best" has no answer. The question "which language suits the thing I actually want to make" has a short one, and that single difference is what gets a person out of the comparison loop.
The figure at the top of this page draws the biggest fork: are you building something people open, or something that eats data and gives an answer. Almost every later question falls under one of those two.
A programming language is a tool, and tools are picked by the job rather than by a poll. Somebody who wants to build client websites and somebody who wants to analyse sales data need different toolboxes, and neither of them is wrong.
One thing is worth knowing early, because it takes the pressure off the decision: the second language comes far faster than the first. The concepts are the same and only the spelling changes. A loop, a condition, a function and an array are one idea in Python, PHP and JavaScript; what takes time is learning to think in the shape of a program, not the syntax. If you want the path from the beginning, the programming track starts here.
Four common goals and the language each one asks for
Find your own cell first, then go looking for a language name.
-
Websites and shops
PHP on the server, JavaScript in the browser. WordPress lives here too.
-
Data and AI
Python, because its libraries were written years before you got here.
-
Mobile apps
Kotlin for Android, Swift for iOS, or Flutter and React Native for both.
-
Games
You pick an engine first and the language comes with it: Unity wants C#.
This table shows the start, not the ceiling. In a real project these cells mix, and somebody a few years in usually knows pieces of three of them.
For websites and freelance work: PHP and JavaScript
If your goal is to be paid for code within a year, this branch is the shortest road. Not out of taste, but because of the shape of the market: most of the work handed to a new developer is a website, most websites are WordPress, and WordPress is written in PHP.
Two numbers that can be checked, read from their own source today: W3Techs reports that PHP is used by 70.2% of the websites whose server side language is known, and that WordPress runs 58.9% of the sites whose content management system is known, which is 40.7% of all sites. Both are global and say nothing about Iran; we do not have market figures for Iran and will not invent one.
JavaScript, though, is not a choice. It is a condition of the medium. Anything that runs inside a browser is JavaScript and there is no second option, so if you go the website way you will meet it. The good news is that you need very little of it to start.
And a warning that usually arrives late: learning PHP is not the same as learning WordPress. The first is a language, the second is a large piece of software with rules of its own. If your work is going to be WordPress, learn enough PHP to read and write a function, an array and a loop, then go to WordPress itself. Six months of pure PHP before your first hook is time that does not come back.
The order we suggest for this branch is plain: HTML first so you know what a page is made of, then some CSS, then JavaScript as far as giving a page behaviour, and PHP when the work reaches the server. If you want to see what kind of jobs this path ends at, our freelance section shows the projects people actually order.
For data and AI: Python
If the work in your head deals with files, numbers and text rather than a page somebody opens, Python is the door. Analysing sales data, cleaning a messy spreadsheet, reading a thousand files and producing one report, talking to AI services: that is all Python ground.
The technical reason is simple and has nothing to do with the beauty of the language: the libraries are there. Work that means two weeks of writing in another language usually has a ready library in Python that has been tested for years. And nearly every AI service writes its first code sample in Python.
One piece of honesty is needed, though. Python is not the shortest road to a first local income. "Write me a Python script" is ordered far less often than "fix my website". If you are in a hurry to earn, the branch above answers faster, and Python can be added later.
We did exactly that ourselves, and it can be seen: the site you are reading is PHP, while the tool that checks this very lesson before it ships is Python. Neither choice was a preference; each is there for a job. If you want to start here, the Python lesson in this track walks through the install and the first script step by step, and the full lesson list sits on the same page.
Mobile and games, where the platform picks the language
In these two branches the decision is not yours, it belongs to the platform. Native Android means Kotlin (and older Java code), native iOS means Swift, and if you want one codebase for both it means Flutter with the Dart language or React Native with JavaScript. For games you usually pick an engine rather than a language: Unity wants C# and Godot has a language of its own.
One blunt thing before you go near an app: quite often what gets called "an app" is in practice a good website on a phone, and it answers for half the cost and a tenth of the trouble. A real app becomes necessary when you need the camera, notifications or offline work.
And a constraint that is specific to us: publishing to the global stores from Iran has problems of its own, and they have nothing to do with which language you picked. That discussion belongs elsewhere, in the app development track, and if you want the work done for you, our app development page explains the shape of it.
The questions that eat your time and change nothing
"Which language is faster" is not your problem. In the kind of work a beginner writes, slowness almost always comes from a bad query, a ten megabyte image or the wrong algorithm, not from the language. The language becomes the bottleneck only after you have done everything else right.
"Which is easier" has no real answer either. For the first two weeks every language looks the same: variables, conditions, loops. The difficulty arrives later and it comes from concepts rather than syntax; pointers, concurrency and object models are hard in any language.
"Which pays more" is answered by global lists, and that answer is useless to you, because you do not get hired in the global market. The number that matters is one that means something in the city and the market where your customers are, and we do not have that number.
Put "language X is dying" aside as well. What matters is not a language's standing on social media; it is whether there is work within your reach that gets done with it.
And do not inflate the cost of a wrong choice: if after two weeks you find you took the wrong branch, you lost two weeks. If you spend six months hunting for "the best language" and finish nothing, you lost six months and learned nothing either. Finishing one small thing matters more than choosing correctly.
A two week test instead of two months of research
The way out of this decision is not more research; it is one small experiment. Take two candidates, build the same small thing in both, and let your hands decide rather than the lists.
"Small thing" means something you finish in an evening that has an output you can show. For example: a page with a form that stores a name, or a script that reads a CSV file and pulls three numbers out of it. Write the same one in both languages so that the comparison is real.
The figure below is those five steps. Take the fourth one seriously: showing it to another person switches something on that coding alone does not. And if neither candidate holds you after two weeks, that is an answer too.
Our own toolbox came out of exactly this kind of decision rather than of taste: the site is PHP because WordPress is PHP, the content tooling is Python because its job is text processing, and the glue between them is twenty one bash scripts because their job is calling other tools. Three languages, three different jobs, and not one of them chosen for being "better".
The two week test, in five steps
Instead of reading other people comparisons, make one small comparison of your own.
-
1
Write the goal in one sentence
If it does not fit in one sentence it is not a goal yet, it is a wish.
-
2
Two candidates, not five
With five options you fall back into the research you were escaping.
-
3
Build the same small thing in both
Something that finishes in an evening and has an output. Not a project.
-
4
Show it to one person
Showing switches something on that coding alone does not.
-
5
Decide from your own experience
If neither held you, that is an answer too: change the goal, not the language.
This test is for choosing between two candidates, not for learning a language. Two weeks is not enough to be good at either, and it is not meant to be.
The fast path, with AI
For this one question a language model is a poor oracle and a good simulator. Ask it "which language should I learn" and it hands you the average of what has been written on the internet, and that average has nothing to do with your city. But make the same model write one small thing in two languages, then say what you will be facing six months down each path, and you have compressed the two week test into an evening. A fast cheap model is enough here; our current pick is in <a class="text-link" href="/en/ai/">the AI section</a>.
- Write the goal with your constraints rather than as a wish: what, for whom, by when, and how many hours a week you actually have.
- Instead of "which is better", ask for the smallest working version of that same one thing in both candidate languages, with the same output.
- Run both yourself. Code that has not been run is an opinion, not a result.
- Finally ask what you will be dealing with six months into each path. That answer is more useful than any popularity list.
Copy-ready recipe
My goal: {goal in one sentence}
My constraints: {hours per week}, {by what date}, {the machine and connection I have}
Two candidates: {first language} and {second language}
Do three things for me, and do not change the order:
1. The smallest working program that demonstrates this goal, once in
{first language} and once in {second language}. Both must produce exactly
the same output. Give complete code, not fragments. List anything that has
to be installed separately.
2. Under each program, point out the three lines a beginner gets stuck on and
say why.
3. Then write what I will be dealing with six months into each path: which
tools, which difficulties, and what kind of work usually gets ordered.
Do not tell me which is better. I will decide after running both.
Before you trust the output: One thing the model does not know and will still speak about confidently: your local market. The list of work that gets ordered in your city is not in its training data, so weigh every sentence about "demand" yourself with a look at local job boards and groups. The second thing is access: the model may propose a tool whose signup or payment does not work from Iran. Before you build a path on something, check that you can actually reach it.
AI in this kind of work
Our position is plain: for choosing a language, do not use the model as an adviser, use it as a workshop. Its advice is the average of the internet; its workshop is putting the same program in two languages in front of you in one evening, so that you can judge with your own hands. The three tools below all do that job and differ little for it.
Tools that actually help
- Claude Good for the two version exercise, because it gives complete code and a line by line explanation together. Iran is not on Anthropic supported countries list; we read that on Anthropic own page.
- Gemini Understands Persian well and is enough for the first version of a small program. Google own page says the Gemini web app runs in over 230 countries and territories, and Iran is not on that list.
- ChatGPT The most common choice and acceptable for this job. We do not have a page for it in our AI section yet, so we make no claim here about its access or pricing.
Where it backfires
The main risk here is not wrong code, it is a confident answer. The model answers "which language should I learn" with the average of what has been written on the internet, and that writing is mostly English and mostly American, so it hands you a tidy roadmap with no relation to the work ordered in your city, and its confident tone hides exactly that. The second risk is access and it is specific to us: the roadmap may contain a tool you cannot sign up for or pay for from Iran, and the same is true of these models themselves. Iran is on neither of Anthropic two supported countries lists and is not on Google list of countries for Gemini; we read both on the vendor own pages, and we do not suggest routes around them. That is why our advice is to ask the model for code rather than for a destiny: code can be run and inspected, a roadmap cannot.
Sources: Anthropic: supported countries Google: where Gemini Apps are available W3Techs: usage statistics of PHP
Where this advice stops
This lesson cannot tell you which skill pays in your city, because we do not have labour market figures for Iran and will not invent one; what is here is two global numbers and one agency experience, no more. There are also three situations that override every argument on this page: if the place you work or study already has a language, that language wins; if you are studying for a university course, the course language wins; and if there is a person who can answer your questions, their language is worth more than any optimal choice, because being alone with it is the most expensive part of learning.
From our own work
Our own toolbox, counted today and checkable on this server: the theme of this site is 193 PHP files and 59,377 lines, our in house plugins are another 592 PHP files, and the page you are reading loads exactly two JavaScript files, about sixteen and five kilobytes. Against that, the tool that checks this very lesson before it ships is Python: 22 files, one of which is 281 lines whose whole job is finding forbidden characters in four languages. The glue between them is 21 bash scripts. The ratio between those numbers is the argument of this lesson: the job picked the language, not us.
Real follow-up questions
Now that AI writes code, is learning a language still necessary?
Yes, though not for the old reason. Somebody who does not know the language cannot tell working code from convincing code, and accepts whatever answer arrives. Learning a language today is more about reading and judging than about typing, and that has raised its value rather than lowered it.
Should you learn HTML first or go straight to Python?
It depends on the branch, not on a traditional order. If you are going the website way, HTML is the first thing, because without it you cannot even see your own output. If you are going the data way, you do not need HTML and going straight to Python is right. Also, HTML is not a programming language; it is a markup language and has no conditions or loops.
How many languages do you need to be hired?
One, to the level where you have built something with it. Job ads that list eight skills side by side are wish lists rather than entry requirements, and a person showing one real project is ahead of a person who knows the names of four languages. The second language usually arrives by itself, because a real project sooner or later forces it on you.