How to start programming in PHP
PHP is a simple and powerful language for developing web projects. Anyone can start writing programs and scripts on it, there is nothing particularly difficult in this. It is only important to understand how to use the capabilities of the language to solve your problems.
To get started, you can go to the official PHP resource - php.net , which contains a large amount of really useful and accessible information for both experienced and novice developers. The documentation is structured in such a way that it is enough to enter any function into the search engine, and a link to its description on the PHP website will be displayed in the first position. It also provides not only a description, but also examples, as well as comments from other developers. So you can always get the most of the information you need.
There are also a large number of third-party sites that have training courses, but it's better to use the official source. So what do you need to get started with development? First, you need to deploy a local server, for example, download and install the OpenServer build , Denwer used to be popular, but it is outdated. OpenServer - great for development, after installation create a directory for the new site, as written in the OpenServer instructions.
When the directory is created, place a file called index.php there. You can write your future script in it. The simplest thing to remember is that PHP code is Php?> or shorthand ?> . You can write any code inside this construction, for example, write " echo 1; ". After that, save the file and run the site in a browser - your unit will be shown on the page. As you can see, everything is very simple.
To edit source code files, you can start by using simple notepads, for example, the excellent development tool - Notepad ++ . The advantages are obvious, instant opening of the file, high speed of work, etc. Although there are those who immediately advise using an entire IDE (development environment) for development, this can only scare a novice developer away, since instead of writing code directly, you will have to study this IDE.
As soon as you can write the first working code, you can proceed further, complicate the task, add any functions, for example, display the current date. For this, PHP has a date () function . For a detailed description, just enter it into a search engine (you can enter date () php) and follow the link to the php.net site, there will be a description of how to use this function.
As you can see, it is very easy to start writing in PHP , after completing the operations described in this article, you will already have a basis for development, you will only have to practice, setting yourself real tasks and finding solutions on the network and then analyze, change parameters, experiment with the code. Gradually, experience will appear, you can move on to more complex techniques, start learning various engines and CMS , which will help you understand how to build your web projects, as well as teach the correct manners of writing PHP code .
- 09.11.23IT / Database Errors when migrating from MySQL 5.6 to 5.7 and how to fix them - database dump import failed with an error or INSERT does not work. Disabling STRICT_TRANS_TABLES strict mode or using IGNORE
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate