What does PHP mean? Probably a lot of people do not know very well, but many people may have heard a word:
"PHP is the best language in the world"。 So, today's article PHP Chinese network will give you a detailed talk about the content of PHP, why say
PHP is a good language in the world?
A: the definition of PHP
According to Baidu Encyclopedia we can know that PHP is a common open source scripting language. The grammar absorbs the C language, Java and Perl features, is conducive to learning, widely used, mainly for the field of web development. So why is PHP the best language in the world?
First, let's take a look at the features of PHP:
(1) PHP running on the server side: Learn PHP, you can command the server to work for you, most of the Web site data is stored on the server side, PHP is used to handle the data stored in the server (powerful bar).
(2) PHP cross-platform: the server can be a variety of platform servers, such as Linux, Windows, Unix, you can command.
(3) PHP is a scripting language: PHP is to write a script, that is, a line of computer instructions to command the server to work, so in the process of writing PHP is actually the process of communication with the server, the language of communication is PHP.
(4) PHP free of charge: PHP is free to use.
Second: Why is PHP a good language in the world?
For the reason that PHP is the best language in the world, I have summed up the following several:
(1) PHP learning threshold is relatively low, PHP is designed for the Web language (although it is now in the Common programming language), it just built a. php file is a Web page, with $_get[' x '] can get the get parameters. (Related recommendation: PHP learning Roadmap)
(2) PHP syntax is relatively simple, PHP is a weak language type, basically for the type of PHP is not necessary to consider, PHP can be very simple to access the data from the database; (related video recommendation: Php.cn lonely Nine Cheap (4)-php video tutorial)
For example, read data:
<?php$servername = "localhost"; $username = "username"; $password = "password"; $dbname = "MyDB"; Create connection $conn = new Mysqli ($servername, $username, $password, $dbname);//Check connectionif ($conn->connect_error) {
die ("Connection failed:". $conn->connect_error);} $sql = "SELECT ID, FirstName, LastName from myguests"; $result = $conn->query ($sql); if ($result->num_rows > 0) {//Output data while ($row = $result->fetch_assoc ()) { echo "ID:". $row ["id"]. "-Name:". $ row["FirstName"]. " ". $row [" LastName "]." <br> ";}} else { echo "0 result";} $conn->close ();? >
Insert data:
<?php$servername = "localhost"; $username = "username"; $password = "password"; $dbname = "MyDB";//Create connection $conn = new mysqli ($servername, $username, $password, $dbname);//Detect connection if ($conn->connect_error) {die ("Connection failed:". $conn->connect_error);} $sql = "INSERT into Myguests (firstname, LastName, email) VALUES (' John ', ' Doe ', ' john@example.com ')," if ($conn->query ( $sql) = = = TRUE) { echo "new record inserted successfully";} else { echo "Error:". $sql. "<br>". $conn->error;} $conn->close ();? >
The above for the implementation of getting data from the database and inserting data is very simple, and now half of the site is basically read and write data from the database.
Three. Summary
Finally, if you do not want to be very troublesome to deploy a site, then PHP is a good language choice, so that PHP is the best language in the world, it should be PHP is the best language for Web development, but also the most dynamic language, in short, the study of PHP is also very easy to find work, After all, many websites are now written in PHP.
Related Courses recommended:
PHP 0 Basics Getting Started Tutorial
Hanshunping 2016 php+mysql Basic Video tutorial