I’m trying to learn PHP

JacobViti
3 min readSep 3, 2021

There is a lot of things to know in web development. HTML, CSS, JavaScript, and list will go on and on. From college, I got a background in a few languages. One of them is PHP. I didn’t do too well with the language originally, but now I am ready to tackle the language and come out on top!

The first difference is how you declare variables

PHP
JavaScript

In PHP, you declare a variable, you use ‘$’ first. As long as you have that, you can declare what the variable should be. Such as an Int, Float, String, or Boolean. In JavaScript, you need to use the keyword “Let”, “Const”, or “Var” before you can declare. After that you can declare it as an Int, Float, String, or Boolean.

PHP
JavaScript

In PHP, you can the array in a function like above, or use brackets. In Javascript, you use brackets. The brackets could be empty or filled with elements. You can also make a new array with the constructor “new Array()”

PHP
JavaScript

In PHP, the most common way to output to the user is to use the keyword “Echo” This will display the information in the string on the webpage. In the example above, it will say what they variables “a” and “firstName” are and what is in the index 1 for the array. In JavaScript, there is no print statement. The most common was is to use an innerHTML or document.write().

I am still learning as a coder and finding new stuff everyday. I am excited to keep on learning and want to create projects using new languages. If you want to see more on what I am doing, you can check out my GitHub here: https://github.com/JakeKViti

--

--